Also,

Using javascript change the action class based on what button is clicked. So:


<input type="button" name="Action1" value="SubmitMe" onClick="fnDoSubmit(this); return 
false;">
<input type="button" name="Action2" value="SubmitMe2" onClick="fnDoSubmit(this); 
return false;">


fnDoSubmit(btn){

 document.myForm.action = btn.value;
 document.myForm.submit;

}


You might need to put the suffix .do to the action in the javascript or the value of 
the buttons.

Rgs
Vikram

-----Original Message-----
From: Victor Hadianto [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 5:15 AM
To: Struts Users Mailing List
Subject: Re: implementing form actions


> I currently define a single action, forward
> all the [operation] buttons to the action and let
> the action distinguish between the various operations
> based on a property name.

Another way of doing this is by utilising an "action" property on your form 
bean and for declare a setters method for the buttons to set the action 
properly. For example:


In you form bean:

public class FormBean {

        int action;

        public setOperation1(String ignore) {
                action = ONE;
        }

        public setOperation2(String ignore) {
                action = TWO;
        }

        
}

And assuming your buttons named operation1 and operation2 you can check based 
on the action content which button the user clicks;

HTH,

-- 
Victor Hadianto
---------------
Don't tell me what you dreamed last night for I've been reading Freud.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to