default submit button

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
 
B

bruce barker \(sqlwork.com\)

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

-- bruce (sqlwork.com)
 
A

Austin Phillips

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
 
G

Gregory Gadow

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.
 
Joined
Sep 15, 2006
Messages
2
Reaction score
0
Austin, it sounds like the focus is set on the item button when you hit the <ENTER> key... you need to set the focus to the desc button when you in the desc textbox. Just write some code to set the focus to the appropriate button for each textbox. My guess is on the textbox_TextChanged event or ...

Have fun,

:roll:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top