Solved

add two submit button to form

Posted on 2007-12-02
2
1,647 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
2 Comments
 
LVL 9

Accepted Solution

by:
ysnky earned 500 total points
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now