Solved

add two submit button to form

Posted on 2007-12-02
2
1,654 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 500 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

623 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