You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Skariah <ms...@anshinsoft.com> on 2002/03/19 20:37:29 UTC
RE: When i have three buttons that all can submit the same form...
Hello Laker,
Pl. read this.
http://jakarta.apache.org/struts/api/org/apache/struts/actions/DispatchActio
n.html
You can also change the form's action using Javascript code.
Ex:
This is the method in Javascript
function changeAction(form, methodToCall)
{
form.action = "myDispatch.do?method=" + methodToCall;
}
In the onclick() event of the button, call the method
changeAction(localform, methodToCall).
Now, if the caller is a button, then the form.submit() is activated
automatically. But if the call is made by some html:link , then an explicit
form.submit() should be called in the Javascript method..
Ex:
function changeAction(form, methodToCall)
{
form.action = "myDispatch.do?method=" + methodToCall;
form.submit();
}
Cheers!
-MS.
-----Original Message-----
From: nsg [mailto:nsg@trans-cosmos.com.cn]
Sent: Thursday, March 14, 2002 5:18 PM
To: Struts Users Mailing List
Subject: When i have three buttons that all can submit the same form...
the three button are: Search, Add,Delete. i set the Search button as submit
type.the other two are button type.
when i want to click Add(or Delete) to submit the form, i should change the
form's action and then submit using JavaScript?
Are there any method else to do that except using JavaScript in Struts
framework?
Thanks in advance.
Laker
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>