
struts2-jquery - issue #412
submit with multiple forms invoke the execute multiple times
(This is for feature requests and bugs in Struts2 jQuery Plugin - for getting help, please use the User Group. http://groups.google.com/group/struts2-jquery )
What steps will reproduce the problem? try sj:submit with multiple forms. 1. in the showcase, create a new field echo2, with getter and setter, and log.debug(echo2) in execute() - Echo.java 2. in form-out.jsp, make a copy of form formOutside. tag all necessary names and ides with 2, e.g., formOutside2, echo2. 3. change the formIds="formOutside,formOutside2" of the sj:submit.
What is the expected output? expect the execute(action) method is executed once with absorbing all fields from multiple forms if no overlapping. What do you see instead? the action method is executed N times for the N forms.- open firebug, can see the framework post the echo.action twice. Which struts2 version? 2.2.1
Which struts2-jquery plugin version? 2.5.1
Please provide any additional information below. If this is not a bug, would please provide the method to make the execute run only once with multiple forms?
- form-out.jsp 5.15KB
Comment #1
Posted on Jan 26, 2011 by Swift Lioni just try it out.
the echo.action is called twice, that ok becouse we submit two forms.
Comment #2
Posted on Jan 26, 2011 by Happy Horsejohgep, this is not ok since we expect the fields of multiple forms to be passed to action with one single Action instance; however, the fact is the Action class is instantiated twice with 2 forms. We sometimes would generate dynamic forms and also need to pass all the fields of these forms into one single Action object then execute the action. It does not make sense to make the same post-response process twice with two forms.
Comment #3
Posted on Jan 27, 2011 by Swift Lioni belive it makes sence in some cases it is fine to execute 2 actions. but i also understand your position. maybe the plugin should have a option combineForms to enable or disable the concatenation of forms.
Comment #4
Posted on Jan 28, 2011 by Happy HorseI agree with you johgep!
Comment #5
Posted on Jan 31, 2011 by Swift Lionwith next version following way is possible.
this way submits both forms.
and this way concat the form values and send the values to the action specified in the href attribute.
http://code.google.com/p/struts2-jquery/source/detail?r=1312
Comment #6
Posted on Feb 1, 2011 by Happy HorseComment deleted
Comment #7
Posted on Feb 8, 2011 by Swift Lion(No comment was entered for this change.)
Comment #8
Posted on May 11, 2011 by Happy ElephantI have this issue with a form inside a dialog:
Todos los campos son requeridos.
UbicaciĆ³n:Status: Fixed
Labels:
Type-Defect
Priority-Medium
Component-Plugin
Milestone-2.5.2