wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes java Script To Handle Multiple Buttons In A Form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "java Script To Handle Multiple Buttons In A Form" Watch "java Script To Handle Multiple Buttons In A Form" New topic
Author

java Script To Handle Multiple Buttons In A Form

eshu khare
Ranch Hand

Joined: Aug 01, 2008
Posts: 44
I am beginner for java.Can you please provide me some hint on how to write a java script to handle multiple buttons for a single form.The Details are as follows :-
My current application is struts-spring-hibernate based.I have a page which has four different buttons and for each buttons I have formed four separate action class though the form bean is unique.Now I want to call all four different action on-click to the respective buttons,but not getting any proper idea for the java script have searched out it online,not seeking the whole code just need some help on it,if could possibly done.


Thanks & Regards
Eshu Khare
Romit Bose
Ranch Hand

Joined: Oct 03, 2007
Posts: 50
Hi!
how about writing a javascript function for each button...(or may be we can club all the options for all the button through an if else block). Lets say the form name is myDocument that you want to submit.


[ December 22, 2008: Message edited by: Romit Bose ]
eshu khare
Ranch Hand

Joined: Aug 01, 2008
Posts: 44
Thanks Romit,It is done.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Or you could have coded your backend to react on the name of the button that was submitted to the page. Disable JavaScript and see how your form works with the solution you have now.

Eric
eshu khare
Ranch Hand

Joined: Aug 01, 2008
Posts: 44
Hi Eric Pascarello ,
can you be please little descriptive,can provide some hint as per to the way you are saying.
 
 
subject: java Script To Handle Multiple Buttons In A Form
 
Similar Threads
Struts 1: Selective Validation of Form
can multiple submit buttons work in STRUTS?
I want two buttons on a page, one for "search refine", one for "submit", how to do ?
multisubmit
multiple submit buttons