[PLUGIN] focus for textbox

  • While I was making a registration form in construct I couldn't find an easy way to validate a field on the run. So extended the existing textbox plugin with the conditions:

    • On focus lost
    • On focus gain

    Focus lost gets triggered when the object was focussed and another object gets the focus.

    Focus gain is the other way around. When any other object was focussed and the given object gets the focus.

    Download

    Hope you enjoy!

  • Thanks for this, Bicky. I think this is a good one to include in the original textbox.

    One thing though, how are you handling focus actions? Like say, returning focus to the canvas after a textbox gets the focus?

    Currently, it seems to me the user is forced to press TAB to get back to the canvas, though perhaps I'm missing something.

    EDIT: I realize the focus gets returned to the canvas when an OK/Submit button is pressed, but what about in cases where you're not using one? Let's say you're using the ESC key to cancel form entry. Have you or anyone else come across that need?

  • <img src="smileys/smiley3.gif" border="0" align="middle"> didn't think anybody would bother with this plugin!

    In that case here's a version which works with r85 as well:

    Download r85 compatible

    About your question Ugotsta:

    The focus changes on clicking on the canvas and on clicking on another form element. As well does it change when pressing TAB to go to a next form field.

    Only thing not working is pressing ESC, this because the field doesn't lose focus (not in Firefox at least). Adding this feature would be outside of the scope of this plugin. All it does is trigger conditions on focus lost and gain. Not on how one can change the focus.

    Hope that helped / clarified.

  • hi..what mean focus for textbox?

    i was create a registration form, i need of user to fill email and phone number as true validation, while user add wrong format email as exmple, so..user cannot continue and display message as tooltip (maybe)

    any one can help me how i can do it

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • when a textbox has focus, you will see the text cursor in it.

    if you need to validate an email address or a phone number, you have to it by yourself...

    I could add an email check to my textbox plugin, but the phone number is different from country to country...

    EDIT: I was wrong, there is a way to determine if a phone number is correct <img src="smileys/smiley17.gif" border="0" align="middle">

    Anyway, I've added the "Validate" condition to my textbox plugin and it will check if the data you have into the textbox is valid (based on the type you choose from the editor).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)