Solved

add two submit button to form

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

861 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

30 Experts available now in Live!

Get 1:1 Help Now