<jr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
When the user type something in text box, and press enter, it will
submit the form data
to test2.jsp, even without pressing submit form button. This is not
what I want, I want to
submit the form only when the user press the submit button. Any
workarounds? Please advise.
thanks!!
<script type="text/javascript">
function submit_me()
{ alert("submit me");
InputForm.submit();
}
</script>
<FORM NAME="InputForm" ACTION="test2.jsp" METHOD="POST">
name <input type="text" name="userName">
<input type="button" onClick="submit_me()" value="submit form">
</FORM>
You do not need JavaScript to submit the form. You might need JavaScript
to do what you are attempting to do (suppress the ability for the submit
to be invoked by the 'Enter' key), but you do not need it to submit the
form.
<!-- NO JAVASCRIPT NEEDED -->
<form name="InputForm" action="test2.jsp" method="POST">
name <input type="text" name="userName">
<input type="submit" value="submit form">
</form>
As for messing with browser functionality and preventing the 'Enter' key
from submitting the form, you can find multiple variations of that theme
at:
<url:
http://www.google.ca/search?q=javasc...ey+submit+form
/>
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq