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

Q2066 How do I disable the ENTER key from activating the form submission?

irt.org | Knowledge Base | HTML | Q2066 [ previous next ]

Q2066 How do I disable the ENTER key from activating the form submission?

This can be achieved by submitting the form using the onClick event handler instead of onSubmit event handler. It is necessary to return false on event handler onSubmit to prevent submit on hitting ENTER key. Sample code:

<form name="form1" onSubmit="return false">
<input type="text">
<input type="button" value="SubmitForm" onClick="document.form1.submit()">
<a href="#" onClick="document.form1.submit()"><img src="button.gif"></a>
</form>

Feedback on 'Q2066 How do I disable the ENTER key from activating the form submission?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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