gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

struts2 sj:submit #905

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.<s:url value="/update.action" id="myUrl"  />
    <div id="myDiv">
        this is me.
    </div>
    <div>
        <s:form action="/update.action">
            <s:textfield name="myTitle" label="Enter plot title"></s:textfield>
            <sj:submit targets="myDiv" href="%{myUrl}" id="mySubmit1" /> 
                         <sj:submit targets="myDiv" id="mySubmit2" > 
        </s:form>
    </div>
2. myDiv is updated without the submittion of form if mySubmit1 is clicked
3. the whole page is refresh if mySubmit2 is clicked

What is the expected output? What do you see instead?
When clicking mySubmit2, the whole page should not refreshed

Which struts2 version?
2.3.4.1

Which struts2-jquery plugin version?
3.4.0

Please provide any additional information below.
I am using struts2-jquery to implement a partial refresh on a page after a form 
is submited.

Original issue reported on code.google.com by Stif...@gmail.com on 18 Oct 2012 at 9:21

GoogleCodeExporter commented 9 years ago
We just have the same issue here. (struts2 2.3.4.1 / struts2-jquery 3.4.0)

We work around this issue by downgrade struts2-jquery plugin to ver. 3.3.3

Original comment by xcooper1...@gmail.com on 18 Oct 2012 at 10:17

GoogleCodeExporter commented 9 years ago
Finally, we add ID to form tag, it work fine now... but it's wired...

Original comment by xcooper1...@gmail.com on 18 Oct 2012 at 10:21

GoogleCodeExporter commented 9 years ago
Thank you for your advice. There is another issue: when i use <sj:submit> tag, 
it seems that the form is submitted twice. is it a known issue?

Original comment by Stif...@gmail.com on 19 Oct 2012 at 4:53

GoogleCodeExporter commented 9 years ago
This bug is a regression from revision 1695: "Solve  Issue 550 : Custome AJAX 
Validation doesn't work with href".

For ajax-forms, struts2_jquery's formsubmit method tries to disable default 
submit behavior. To do this, it requires the formids option to be set for the 
submit tag.

Initializing the formids option is the responsibility of struts2_jquery's 
button method but since revision 1695, it does not.

If the submit-tag is part of a struts-form with an id, the submit-tag will 
initialize formIds on render.

Attached is a slightly simpler reproduction. A symptom of the bug is that a 
script error is triggered in browsers on load of test.jsp.

Original comment by Elias.Wu...@apptus.com on 25 Jan 2013 at 12:14

Attachments: