Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BIG problem with two forms and ENTER key

Status
Not open for further replies.

rsshetty

Programmer
Dec 16, 2003
236
US
I have two forms in the same page which load two different pages after hitting submit.
The problem arises if I click the enter button. One of the forms gets submitted without taking in any of the form values.

Is there any way I can control which form is submitted when the user presses ENTER depending on which form the user filled out?


rsshetty.
It's always in the details.
 
Code:
<form name="frmsearchallresults" method=post onsubmit="return ValidateInput('<%=someVariable%>');">

<input  onkeypress="return entsub()" type=text size="50" name="Keyword" style="border-color:#657D95;">
<INPUT class="submit" type="submit" value="SEARCH ALL" onMouseover="javascript:highlightButton('submithover')" onMouseout="javascript:highlightButton('submit')" id=submit3 name=submit3>  <INPUT type="hidden" name="submit3" value="SEARCH ALL"> <INPUT class="submit" type="button" value="RESET FIELDS" onMouseover="javascript:highlightButton('submithover')" onMouseout="javascript:highlightButton('submit')" id=submit4 name=submit4 onclick ="location.href='<%=Application("Webroot") & "/messageboard/search.asp"%>'">
</form>
second form
Code:
<FORM  method="POST"  OnSubmit="return ValidateForm();" name="frmsearch">
								......(its a really big form)
</form>
When I hit ENTER, the second form gets submitted. The smaller form was added recently.

rsshetty.
It's always in the details.
 
Maybe it is entsub(),... Also by what construction in the form do you anticipate enter-key (and where?) will trigger submission of a form?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top