.net - Enter key triggers wrong submit button -


i working on mvc application. 2 tables each have individual submit button. table1 has default submit on enter key. how change submit button based on textbox focus?

<table> ...<td align="left"><%= html.textbox("name")%></td> ...<input id="namesubmit" name="namesubmit" type="submit" value="search"/> </table> <table> ...<td align="left"><%= html.textbox("idnum")%></td> ...<input id="idsubmit" name="idsubmit" type="submit" value="search"/> </table> 

i tried using panel, "the defaultbutton of 'panel1' must id of control of type ibuttoncontrol".

any ideas?

if wrap each of submits in <form> tags should determine submit clicked such:

<table>     <form id="form1">         <td align="left"><input id="name" /></td>         <input id="namesubmit" name="namesubmit" type="submit" value="search"/>     </form>        </table> <table>     <form id="form2">         <td align="left"><input id="number" /></td>         <input id="idsubmit" name="idsubmit" type="submit" value="search"/>     </form> </table> 

this make enter presses while textbox focused submit corresponding form.

here demo of working, hope helps out.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -