aspose file tools*
The moose likes JSP and the fly likes multiple submit buttons on html forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "multiple submit buttons on html forms" Watch "multiple submit buttons on html forms" New topic
Author

multiple submit buttons on html forms

marcosss kant
Greenhorn

Joined: Nov 14, 2005
Posts: 1
Hi, I am building an application that has only one html form, but three submit buttons. I know that forms can only have one possible action, so does anybody know how to have the three buttons? Right now, I have three forms (one for each button) that take exactly the same information, so if you don�t know how to have multiple buttons, do you know how to pass information from one form to another in the same html page?

Thanks.
[ November 14, 2005: Message edited by: Bear Bibeault ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29259
    
140

Marcosss,
You can use a javascript function to change the form's action when each button is clicked.

Since this question isn't about the IDE in particular, I'll move it to our JSP forum. Welcome to JavaRanch!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The value of the button that was clicked will be sent along with the other form fields.
The value of the other button's won't be sent.

This means that you can branch your code on the server and perform different actions according to which button was pressed.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: multiple submit buttons on html forms
 
Similar Threads
multisubmit
Multiple Form Handling in JSP and Servlets for File Uploading
Multiple forms using same radio button choice
Can I have three buttons(same row) in the same form?
multiple submit buttons