Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q682 Is it possible to cause a multi-field form to be submitted when the user hits the enter key no matter which field on the form the cursor is in?

irt.org | Knowledge Base | JavaScript | Form 7.1 | Q682 [ previous next ]

Q682 Is it possible to cause a multi-field form to be submitted when the user hits the enter key no matter which field on the form the cursor is in?

Try:

<SCRIPT LANGUAGE="JavaScript"><!--
function submit1() {
    document.useridForm.passwordField.value = document.passwordForm.passwordField.value;
}

function submit2() {
    document.passwordForm.useridField.value = document.useridForm.useridField.value;
}
//--></SCRIPT>

<FORM NAME="useridForm" onSubmit="submit1()">
<P>Userid: <INPUT NAME="useridField" TYPE="TEXT">
<INPUT NAME="passwordField" TYPE="HIDDEN">

<SCRIPT LANGUAGE="JavaScript"><!--
document.write('<\/FORM><FORM NAME="passwordForm" onSubmit="submit2()">')
//--></SCRIPT>

<INPUT NAME="useridField" TYPE="HIDDEN">
<P>Password: <INPUT NAME="passwordField" TYPE="PASSWORD">

<P><INPUT TYPE="SUBMIT">
</FORM>

Feedback on 'Q682 Is it possible to cause a multi-field form to be submitted when the user hits the enter key no matter which field on the form the cursor is in?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.