Mutiple submit buttons in a single page

  • Thread starter Thread starter Bob Lehmann
  • Start date Start date
B

Bob Lehmann

Hi,

I pretty sure I've seen this problem addressed before, but I can't find any
references.

The short story is that I have I have multiple submit buttons on a page,
each providing different functionality. For example, I have a search option,
a log in option and a save text option.

I would like to handle the submits in the Click event of each button. the
problem is, that since only one form is allowed per page, only the first
button's Click event fires.

I've tried capturing keypresses with client-side code in an attempt to force
the user to click the corresponding button for each set of functionality,
but have found that to be very unreliable across browsers.

Are there any resources available that address this problem?

Thanks,
Bob Lehmann
 
To clarify - I'm trying to handle the Click when the ente key is pressed.

Bob Lehmann
 
Are you talking about ASP.NET? if yes, are the submit buttons you mentioned
WebCobtrol buttons? If your answer is yes, then all these buttons have
server side Click event that you can handle. I do not understand why you
call this a problem, unless these buttons are all HTML buttons and not run
at server (i.e without "runat='sever'" attribute). But since you are asking
in .NET group,...
 
Are you talking about ASP.NET?
Yes.
are the submit buttons you mentioned WebCobtrol buttons? Yes.

then all these buttons have server side Click event that you can handle.
I know.
I do not understand why you call this a problem
As I said, because you are only allowed one form on a page only the first
button's Click event fires when a user presses Enter.

Bob Lehmann
 
Bob,

Than you should probably set the focus on the next. I could not do that
using serverside code yet, because it has to be done as the button is placed
in HTML on the page by the browser.
This is a textbox, however a button would be the same in my opinion.

<INPUT tabindex="1" id="TextBox1" type="text" size="27">

//This should be the last rows in your html aspx file

<script language="JavaScript">
document.all("fieldid").focus();
</script>
</HTML>

I hope this helps a little bit?

Cor
 
Back
Top