You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Guilherme Bisconcini <gu...@sefisa.com.br> on 2016/06/23 20:11:45 UTC
Multiple Submit Buttons in Same Form using Jquery/Ajax
Hi,
I have spent about 3 hours trying to do Multiple Submit Buttons in same
form using Jquery/Ajax. I have tried
https://struts.apache.org/docs/multiple-submit-buttons.html without success.
I'm using Jquery with struts, so I think thats why it doens't work?
because my Struts is: 2.3.28.1
and Json struts plugin: 2.3.28.1 also
I have also tried with the option:
(in struts.xml)
*<constant name="struts.mapper.action.prefix.enabled" value="true" />*
Here are my JSP file:
*<s:form id="leitura" action="leituraAction" theme="bootstrap"*
* cssClass="well form-horizontal">*
* <s:textfield name="tcpAddress" label="TCP/IP" tooltip="Coloque o endereço
IP do reader" placeholder="Endereco" />*
* <sj:submit type="submit" value="Unico" name="unico" cssClass="btn
btn-primary" targets="funcional" />*
* <sj:submit type="submit" value="Burst Start" name="burstStart"
cssClass="btn btn-success" targets="funcional" />*
* <sj:submit type="submit" value="Burst Stop" name="burstStop"
cssClass="btn btn-danger" targets="funcional" />*
*</s:form>*
The action file is nothing special, I have tried my action file with all
types in the tutorial of:
https://struts.apache.org/docs/multiple-submit-buttons.html mentioned.
*Theres any special thing to do Multiple Buttons in same Form using
Jquery/Json <sj:submit ? *
Thanks in advance,
Bisconcini
Re: Multiple Submit Buttons in Same Form using Jquery/Ajax
Posted by Guilherme Bisconcini <gu...@sefisa.com.br>.
Worked, thank you very much!
On Fri, Jun 24, 2016 at 12:05 PM, Johannes Geppert <jo...@gmail.com> wrote:
> Looks like you are using the Stuts jQuery Plugin.
> You can specify th action url on this button itself.
>
> See example in the Showcase (AJAX/Form/AJAX Forms)
> http://struts.jgeppert.com/struts2-jquery-showcase/index.action
>
> <s:form id="form" action="echo" theme="simple" cssClass="yform">
> <fieldset>
> <legend>AJAX Form</legend>
> <div class="type-text">
> <label for="echo">Echo: </label>
> <s:textfield id="echo" name="echo" value="Hello
> World!!!"/>
> </div>
> <div class="type-button">
> <sj:submit
> id="formSubmit1"
> targets="formResult"
> value="AJAX Submit"
> indicator="indicator"
> button="true"
> />
> <s:url id="simpleecho"
> value="/simpleecho.action"/>
> <sj:submit
> id="formSubmit2"
> href="%{simpleecho}"
> targets="formResult"
> value="AJAX Submit 2"
> indicator="indicator"
> button="true"
> />
> </div>
> </fieldset>
> </s:form>
>
> Best Regards
>
> Johannes
>
> #################################################
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
>
> 2016-06-23 22:11 GMT+02:00 Guilherme Bisconcini <
> guilherme.bisconcini@sefisa.com.br>:
>
> > Hi,
> >
> > I have spent about 3 hours trying to do Multiple Submit Buttons in same
> > form using Jquery/Ajax. I have tried
> > https://struts.apache.org/docs/multiple-submit-buttons.html without
> > success.
> >
> > I'm using Jquery with struts, so I think thats why it doens't work?
> >
> > because my Struts is: 2.3.28.1
> > and Json struts plugin: 2.3.28.1 also
> >
> > I have also tried with the option:
> > (in struts.xml)
> >
> > *<constant name="struts.mapper.action.prefix.enabled" value="true" />*
> >
> > Here are my JSP file:
> >
> > *<s:form id="leitura" action="leituraAction" theme="bootstrap"*
> >
> > * cssClass="well form-horizontal">*
> >
> > * <s:textfield name="tcpAddress" label="TCP/IP" tooltip="Coloque o
> endereço
> > IP do reader" placeholder="Endereco" />*
> >
> > * <sj:submit type="submit" value="Unico" name="unico" cssClass="btn
> > btn-primary" targets="funcional" />*
> >
> > * <sj:submit type="submit" value="Burst Start" name="burstStart"
> > cssClass="btn btn-success" targets="funcional" />*
> >
> > * <sj:submit type="submit" value="Burst Stop" name="burstStop"
> > cssClass="btn btn-danger" targets="funcional" />*
> >
> >
> > *</s:form>*
> >
> > The action file is nothing special, I have tried my action file with all
> > types in the tutorial of:
> >
> > https://struts.apache.org/docs/multiple-submit-buttons.html mentioned.
> >
> > *Theres any special thing to do Multiple Buttons in same Form using
> > Jquery/Json <sj:submit ? *
> >
> > Thanks in advance,
> >
> > Bisconcini
> >
>
Re: Multiple Submit Buttons in Same Form using Jquery/Ajax
Posted by Johannes Geppert <jo...@gmail.com>.
Looks like you are using the Stuts jQuery Plugin.
You can specify th action url on this button itself.
See example in the Showcase (AJAX/Form/AJAX Forms)
http://struts.jgeppert.com/struts2-jquery-showcase/index.action
<s:form id="form" action="echo" theme="simple" cssClass="yform">
<fieldset>
<legend>AJAX Form</legend>
<div class="type-text">
<label for="echo">Echo: </label>
<s:textfield id="echo" name="echo" value="Hello World!!!"/>
</div>
<div class="type-button">
<sj:submit
id="formSubmit1"
targets="formResult"
value="AJAX Submit"
indicator="indicator"
button="true"
/>
<s:url id="simpleecho" value="/simpleecho.action"/>
<sj:submit
id="formSubmit2"
href="%{simpleecho}"
targets="formResult"
value="AJAX Submit 2"
indicator="indicator"
button="true"
/>
</div>
</fieldset>
</s:form>
Best Regards
Johannes
#################################################
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
2016-06-23 22:11 GMT+02:00 Guilherme Bisconcini <
guilherme.bisconcini@sefisa.com.br>:
> Hi,
>
> I have spent about 3 hours trying to do Multiple Submit Buttons in same
> form using Jquery/Ajax. I have tried
> https://struts.apache.org/docs/multiple-submit-buttons.html without
> success.
>
> I'm using Jquery with struts, so I think thats why it doens't work?
>
> because my Struts is: 2.3.28.1
> and Json struts plugin: 2.3.28.1 also
>
> I have also tried with the option:
> (in struts.xml)
>
> *<constant name="struts.mapper.action.prefix.enabled" value="true" />*
>
> Here are my JSP file:
>
> *<s:form id="leitura" action="leituraAction" theme="bootstrap"*
>
> * cssClass="well form-horizontal">*
>
> * <s:textfield name="tcpAddress" label="TCP/IP" tooltip="Coloque o endereço
> IP do reader" placeholder="Endereco" />*
>
> * <sj:submit type="submit" value="Unico" name="unico" cssClass="btn
> btn-primary" targets="funcional" />*
>
> * <sj:submit type="submit" value="Burst Start" name="burstStart"
> cssClass="btn btn-success" targets="funcional" />*
>
> * <sj:submit type="submit" value="Burst Stop" name="burstStop"
> cssClass="btn btn-danger" targets="funcional" />*
>
>
> *</s:form>*
>
> The action file is nothing special, I have tried my action file with all
> types in the tutorial of:
>
> https://struts.apache.org/docs/multiple-submit-buttons.html mentioned.
>
> *Theres any special thing to do Multiple Buttons in same Form using
> Jquery/Json <sj:submit ? *
>
> Thanks in advance,
>
> Bisconcini
>