Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

add two submit button to form

Posted on 2007-12-02
2
Medium Priority
?
1,656 Views
Last Modified: 2012-08-14
hi,
i have a form which has a field such as( text box, radio button), i want to have two submit button labeled "add" and "delete" both will get the form parameter and goes to different jsp pages for example (add.jsp for button"add" and delete.jsp for button"delete") and berform different actions,
how i can modify the action of the form to handle actions in different pages depends on the button that has been clicked??
0
Comment
Question by:master_programmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
ysnky earned 2000 total points
ID: 20390811
for a simple sample;
<script>
function submitForm(F, type) {
	
	var loc = "";
	if (type == 'A')
	  loc = "add.jsp";
	else
		loc = "delete.jsp"; 
		
	F.action=loc;
	F.submit();
}
</script>
<form method=post>
<input type=text name=test value="test">
<input type=button value="add" onclick="submitForm(this.form, 'A')">
<input type=button value="delete" onclick="submitForm(this.form, 'D')">
</form>

Open in new window

0
 
LVL 28

Expert Comment

by:gamebits
ID: 20390928
With php I would have the action set to go to the same page and on that page I would have a switch statement to take proper action action depending on what button has been clicked
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question