default submit button

  • Thread starter Thread starter Austin Phillips
  • Start date Start date
A

Austin Phillips

I have a form that has 2 text box for input and 2 buttons.

Like so:

Enter item: <textbox> <button>
Enter desc: <textbox> <button>

When I am in the item textbox and press enter I would like to go to page
item.aspx
When I am in the desc textbox and press enter I would like to go to page
desc.aspx

Whenever I ht <ENTER> item button is always activated.

Any tips?

Thanks,
Austin
 
use two html forms, one for each text button set. set the actions to the
desired pages.

-- bruce (sqlwork.com)
 
Hey Bruce;
WHen i place 2 forms on a .aspx page, I get an error stating only one form
can go on a page?

thanks,
Austin
 
Austin said:
I have a form that has 2 text box for input and 2 buttons.

Like so:

Enter item: <textbox> <button>
Enter desc: <textbox> <button>

When I am in the item textbox and press enter I would like to go to page
item.aspx
When I am in the desc textbox and press enter I would like to go to page
desc.aspx

Whenever I ht <ENTER> item button is always activated.

Any tips?

Bruce has the right idea, but I've never gotten multiple <form> tags to work
on an ASP.Net page.

Instead, put each text box and button combo inside a <asp:Panel> control. On
each panel, add the attribute, DefaultButton="ButtonName". The button should
be an <asp:Button> control, and the value ButtonName should be the ID
attribute of the button.

The panels will be rendered as <div> controls, and supporting Javascript
will be injected for each of the two divs to make the buttons behave as you
want.
 
Back
Top