Activating a method

I have fields on a form which trigger methods on losing focus. However, if the user jumps directly from entering data (field still selected) to pressing a button, nothing happens on the first button click. Obviously the onFocusLost method is doing its stuff on the first click but the user doesn’t know that.

I’ve tried inserting controller.saveData(); at the beginning of the button’s method. That still doesn’t allow for single click action.

The user won’t necessarily always jump from one of these fields to the button, so I can’t call the button’s script from the onFocusLost method.

Any ideas?

what do you do with onFocusLost?
onFocusLost should only do things to the element itself (setting colors or something)

But are you saying that you are in a field and then directly a button is pressed the onFocusLost isn’t triggered?

Problem resolved by switching method from onFocusLost to onFocusGained followed by RequestFocus for the current field.

requestFocus for current field?
why would you do a request focus for a field that already has focus?

jcompagner:
requestFocus for current field?
why would you do a request focus for a field that already has focus?

You’re right! Unnecessary. :oops: