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

Q27 How can I submit a form which has more than one text field by just pressing enter?

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

Q27 How can I submit a form which has more than one text field by just pressing enter?

This is achieved with the following code:

<script language="JavaScript"><!--
function submit1() {
    document.passwordForm.passwordField.focus();
    return false;
}

function submit2() {
    document.passwordForm.useridField.value = document.useridForm.useridField.value;
    /* perform any validation here */
    return true;
}
//--></script>

<form name="useridForm" onSubmit="return submit1()">
<p>Userid: <input name="useridField" type="text">
</form>

<form name="passwordForm" onSubmit="return submit2()">
<input name="useridField" type="hidden">
<p>Password: <input name="passwordField" type="password">
</form>

Feedback on 'Q27 How can I submit a form which has more than one text field by just pressing enter?'


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.