You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PEGASUS84 <pe...@hotmail.it> on 2009/03/11 15:51:48 UTC

one action with two buttons

good evening,
in my project i've to create a form with two buttons wich make two different
process:
i try this method:
<s:form id="configureform" name="configureform"> 
SOME table here or some fields 
</s:form> 

<s:url id="configure" value="Configure.action" /> 
<s:a href="%{configure}" showLoadingText="false" id="configure"
formId="configureform">Cancel</s:a> 


but it doesn't work.

Can someone help me? 
-- 
View this message in context: http://www.nabble.com/one-action-with-two-buttons-tp22456812p22456812.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: one action with two buttons

Posted by mitch gorman <mg...@shadowtv.biz>.
PEGASUS84 wrote:
> it doesnt work mean that the action go to a jsp page but the data in the form
> there aren't in the jsp page
>   

    okay, i just took another look through my code, and it looks like i
incorrectly constructed the example in my response.

    what i *should* have suggested you try was something along the lines
of the following:

                <s:url id="actionurl" namespace="/" action="doRefresh" />
                <form id="<s:property value="displayform" />"
action="<s:property value="#actionurl" />" >

                   [ fields... ]

                    <s:a theme="ajax" targets="targetDiv"
showLoadingText="false" formId="displayform">
                        <img src="refresh.gif" />
                    </s:a>
                </form>

    that is a trimmed-down version of an actual working form in my
current application, which refreshes the contents of a div with the id
"targetDiv".

    (bear in mind, you're gonna need to include the <s:head
theme="ajax"> (for v2.0.x) in your <head> tag, for all this ajax hooey
to work correctly...)
  
    (shouldn't have tried to wing it, should've just gone straight to my
code for a working example in the first place.  sorry 'bout that.)



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: one action with two buttons

Posted by PEGASUS84 <pe...@hotmail.it>.
it doesnt work mean that the action go to a jsp page but the data in the form
there aren't in the jsp page
-- 
View this message in context: http://www.nabble.com/one-action-with-two-buttons-tp22456812p22464237.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: one action with two buttons

Posted by "Kra, Aime yao (TEK System)" <ak...@allstate.com>.
Did you try the following sample. It works for me

http://struts.apache.org/2.x/docs/multiple-submit-buttons.html

Regards

Aimé Kra

-----Original Message-----
From: PEGASUS84 [mailto:pegasus84@hotmail.it] 
Sent: Wednesday, March 11, 2009 10:52 AM
To: user@struts.apache.org
Subject: one action with two buttons


good evening,
in my project i've to create a form with two buttons wich make two different
process:
i try this method:
<s:form id="configureform" name="configureform"> 
SOME table here or some fields 
</s:form> 

<s:url id="configure" value="Configure.action" /> 
<s:a href="%{configure}" showLoadingText="false" id="configure"
formId="configureform">Cancel</s:a> 


but it doesn't work.

Can someone help me? 
-- 
View this message in context: http://www.nabble.com/one-action-with-two-buttons-tp22456812p22456812.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: one action with two buttons

Posted by Martin Gainty <mg...@hotmail.com>.
the assigned value to the submit button has to be unique as illustrated here
http://struts.apache.org/2.x/docs/multiple-submit-buttons.html

note the distinction of buttonName to compare to 'Submit' or 'Cancel'
if ("Submit".equals(buttonName))HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Wed, 11 Mar 2009 07:51:48 -0700
> From: pegasus84@hotmail.it
> To: user@struts.apache.org
> Subject: one action with two buttons
> 
> 
> good evening,
> in my project i've to create a form with two buttons wich make two different
> process:
> i try this method:
> <s:form id="configureform" name="configureform"> 
> SOME table here or some fields 
> </s:form> 
> 
> <s:url id="configure" value="Configure.action" /> 
> <s:a href="%{configure}" showLoadingText="false" id="configure"
> formId="configureform">Cancel</s:a> 
> 
> 
> but it doesn't work.
> 
> Can someone help me? 
> -- 
> View this message in context: http://www.nabble.com/one-action-with-two-buttons-tp22456812p22456812.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Access your email online and on the go with Windows Live Hotmail.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Access_022009

Re: one action with two buttons

Posted by mitch gorman <mg...@shadowtv.biz>.
PEGASUS84 wrote:
> good evening,
> in my project i've to create a form with two buttons wich make two different
> process:
> i try this method:
> <s:form id="configureform" name="configureform"> 
> SOME table here or some fields 
> </s:form> 
>
> <s:url id="configure" value="Configure.action" /> 
> <s:a href="%{configure}" showLoadingText="false" id="configure"
> formId="configureform">Cancel</s:a> 
>
>
> but it doesn't work.
>
>   

    well, lacking a clear definition of what "it doesn't work" might
mean, i can make the following suggestions:

<div id="targetdiv">Initial contents</div>
<s:form id="configform">
    [fields...]
</s:form>
<s:url id="configure" action="Configure.action" />
<s:a href="%{#configure}" theme="ajax" showLoadingText="false"
formId="configform" targets="targetdiv">Configure</s:a>

    note in particular the following:

1) the presence of a div to capture the result of the Configure action.
2) the use of the "action" attribute in the <s:url> tag, rather than the
"value" attribute.
3) the presence of the pound sign in the value of the "href" attribute
of the <s:a> tag
4) the presence of the 'theme="ajax"' attribute and value in the <s:a> tag
5) the presence of the 'targets="targetdiv"' attribute and value in the
<s:a> tag


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: one action with two buttons

Posted by PEGASUS84 <pe...@hotmail.it>.
thanks but it doesn't take data from form yet
-- 
View this message in context: http://www.nabble.com/one-action-with-two-buttons-tp22456812p22465024.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org