1 Reply Latest reply on May 1, 2007 2:59 PM by Greg Dove

    Textfield Listener

      How do you trigger an onFocus event for a input text field? I've got a custom validation that turns the field red with white text and I need to change it back to white with black text when the user selects the field, but I cannot seem to get an event listener to work with it for anything other than onChange.
        • 1. Re: Textfield Listener
          Greg Dove Level 4
          To handle this event for a specific text field, use the onSetFocus handler.... it's not an 'event' that is able to be passed to a listener (to do that you use the Selection class).

          So just assign the function that will change the textfields font/colours in the following way

          myTextFieldInstance.onSetFocus = function() { //or you could use a separately defined function here
          //change the fonts etc here.

          Do a similar thing if you want to change things on exit from the textfield with onKillFocus.

          If you want to manage multiple textfields, then you're probably better off using the Selection class with a listener for onSetFocus. It gives you the object that lost focus and whatever has received focus each time it is triggered.