File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submit problem

 
Joshua Cloch
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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">
</form>

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

process()
{ 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
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 -



HTH
 
Joshua Cloch
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic