P
Patrick
I have a form filled with 6-7 text fields. By default, the Enter key
will submit the form (even if I set focus to a specific field on the
page load).
I use the onSubmit event to perform some data validation. If there is
a problem with any of the fields, I set focus on the field with the
focus() and do a select() before returning false to the onSubmit.
This, of course, causes the field in question to be highlighted with
focus in the field.
However, at this point, pressing the Enter button will not re-submit
the form. Anyone know why this is?
I had suspected that by putting focus in the field, I was making the
field the "activeElement", so the keystroke of Enter was acting as a
CR, but since it was a one line input type of text, I wasnt noticing.
However, when I set focus on the field during the onLoad() of the
page, it works fine.
Any comments? Workarounds?
Thank you,
Patrick
will submit the form (even if I set focus to a specific field on the
page load).
I use the onSubmit event to perform some data validation. If there is
a problem with any of the fields, I set focus on the field with the
focus() and do a select() before returning false to the onSubmit.
This, of course, causes the field in question to be highlighted with
focus in the field.
However, at this point, pressing the Enter button will not re-submit
the form. Anyone know why this is?
I had suspected that by putting focus in the field, I was making the
field the "activeElement", so the keystroke of Enter was acting as a
CR, but since it was a one line input type of text, I wasnt noticing.
However, when I set focus on the field during the onLoad() of the
page, it works fine.
Any comments? Workarounds?
Thank you,
Patrick