|
|
Q1775 On a form with multiple Submit buttons and input fields, how to you choose which one is pressed when the Enter key is hit?
irt.org | Knowledge Base | JavaScript | Form 7.3 | Q1775 [ previous next ] Q1775 On a form with multiple Submit buttons and input fields, how to you choose which one is pressed when the Enter key is hit?Say you have 6 text fields in a form, each with its own "Go" button to submit the form. You want to ensure that when the user hits the Enter key while in a textbox, the corresponding "Go" button is pressed. It involves capturing keypress events for the form, then whenever chr(13) is hit, checking if one of the textboxes has the focus. If it does, we swallow the keystroke and programatically click the corresponding button.
Submitted by Richard Kagerer Feedback on 'Q1775 On a form with multiple Submit buttons and input fields, how to you choose which one is pressed when the Enter key is hit?' |
-- div -->
|