This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes submit problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "submit problem" Watch "submit problem" New topic

submit problem

Joshua Cloch
Ranch Hand

Joined: Apr 27, 2006
Posts: 95
Hey guys!

Assume there are more than one submits in a web page,like:

<form action="" onsubmit="process()">
<input type="submit" name="a">
<input type="submit" name="b">

In the method process(),the snippet seems like:

{ if a is chosen

if b is chosen


How do i know which one is chosen by the user?

Thanks very much.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

I am not sure if it is possible to find out the button used to trigger a form submission, but an alternative approach may be to use something like -


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Joshua Cloch
Ranch Hand

Joined: Apr 27, 2006
Posts: 95
yes, that is a good idea, thanks.

however, if the submit is a component of web page, it should be ok to determine which is chosen...
jQuery in Action, 2nd edition
subject: submit problem