File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
Sonny Gill LinkedIn
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...
I agree. Here's the link:
subject: submit problem
It's not a secret anymore!