gigaZhang / struts2-jquery

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

form submission doesn't work with <sjm:a tag validate="true" ...> #928

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
for struts-jquery-mobile-plugin-3.4.0, when use sjm:a to ajax submit form,after 
ajax form validation,it will encounter error:"SyntaxError: JSON.parse: 
unexpected character"

below is code snippet:

 <s:form id="checkboxlist_form1" action="echo" theme="simple">
    <s:hidden name="ajax" value="true"/>
    <sjm:checkboxlist
        id="checkboxlist1"
            name="echo"
            label="Friends"
            list="{'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
    />
    <sjm:a 
        id="checkboxlist_form_link1"  formIds="checkboxlist_form1"                        targets="checkboxlist_form_result_1" 
    button="true" 
    buttonIcon="gear"                         validateFunction="customeValidation"
onBeforeTopics="removeErrors"
onSuccessTopics="removeErrors"
    validate="true"
       >
         Submit
      </sjm:a>

</s:form>   

<div id="checkboxlist_form_result_1">Submit form above.</div>

when submit form, the post parameter is: 
"ajax=true&__multiselect_echo=&struts.enableJSONValidation=true&struts.validateO
nly=true"

the response is:
<div>
     Echo : 
</div>

and there is a javascript error occurred on jquery-1.8.2.js (line 514):
SyntaxError: JSON.parse: unexpected character
return window.JSON.parse( data );

Original issue reported on code.google.com by allinw...@gmail.com on 12 Dec 2012 at 2:46

GoogleCodeExporter commented 9 years ago
What is your Struts2 Version?
The AJAX Link Example in the Mobile Showcase is working.

Original comment by johgep on 13 Jan 2013 at 9:53

GoogleCodeExporter commented 9 years ago
It's due to my struts2 configuration error, it's work now. this issue can be 
closed. thanks!

Original comment by allinw...@gmail.com on 20 Jun 2013 at 6:30