Reputation: 23
On the current website I am working on we have a Html Form that wraps everything and is used by the global search to submit and search when the user presses enter in the "global search" text box.
The problem we are now having is that we have a application form which has its own text boxes within this Html Form and when you press enter it does a onSubmit for the Global Search.
So in short I was wondering if there was any way to change certain specific text boxes to do a different onSubmit than the global search.
Many Thanks,
Vincent Kong
Upvotes: 0
Views: 172
Reputation: 11759
Although this quickly becomes messy, you can set the CommandName
attributes on each of your buttons and handle them appropriately (based on the command value of the clicked button) during the postback.
Upvotes: 0
Reputation: 3337
Instead of using type="submit" buttons use regular buttons (type="button") then call javascript to do what you want.
Upvotes: 1
Reputation: 491
you can use HTML5 formaction Attribute:
<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit"><br>
<input type="submit" formaction="demo_admin.asp" value="Submit as admin">
</form>
Upvotes: 0