input_focusFirstInvalid

input_focusFirstInvalid

  

A samll question on "input_focusFirstInvalid" action

I have known that if I use the action,it will set the focus in the first invalid input of form.

But what happens if i dont use this action?

Through testing in IDE,I get the same result whether i use the action or not.

I cant find the different between those.

Thanks!



Solution

Hi yanyi

The INVALID MESSAGE appears ONLY when you have the focus in an input that is marked to be invalid.
What the input_focusFirstInvalid does is to put the focus on the first invalid input. This way, the message appears automatically.

If you don't use it, the message only appears if you click the input (unless you have something else that is setting the focus to an invalid input).

Cheers.

Solution

Hi Yanyi,

If we don't use the "input_focusFirstInvalid" then by default the invalid input boxes are just highlighted with a red border. But when we use the "input_focusFirstInvalid" then this function sets the focus to the very first incorrect input box and the input box is highlighted with red color along with the validation message.

Pravi Gupta wrote:

Hi Yanyi,

If we don't use the "input_focusFirstInvalid" then by default the invalid input boxes are just highlighted with a red border. But when we use the "input_focusFirstInvalid" then this function sets the focus to the very first incorrect input box and the input box is highlighted with red color along with the validation message.

Pravi, this is what I already said.

Cheers


Pravi Gupta wrote:

Hi Yanyi,

If we don't use the "input_focusFirstInvalid" then by default the invalid input boxes are just highlighted with a red border. But when we use the "input_focusFirstInvalid" then this function sets the focus to the very first incorrect input box and the input box is highlighted with red color along with the validation message.

Thank you very much