hungsama / struts2-jquery

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

formsubmit function throws exception up when it tries to split() the null formIds attribute in sj:button tag. #979

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Create a <sj:submit/> that has target attribute set but no formIds or href 
set.
2. Submit the form
3. formsubmit function blows up when it tries to split() the null formIds 
attribute

/** Handle all AJAX Forms submitted from Anchor or Submit Button */
formsubmit : function($elem, o, topic) {
...    
if (o.targets) {
...
 $.each(o.targets.split(','), function(i, target) {
   ...
    $.each(o.formids.split(','), function(i, f) { //jquery.struts2.js - line 946 
     ....
What is the expected output? What do you see instead?
Form should submit

Which struts2 version?

Which struts2-jquery plugin version?
3.5.1

Original issue reported on code.google.com by da...@kickflipinc.com on 17 May 2013 at 8:12

GoogleCodeExporter commented 9 years ago
Do you have placed the <sj:submit/> button inside of an form. 

Original comment by johgep on 29 May 2013 at 5:00

GoogleCodeExporter commented 9 years ago
Yes, sj:submit is within a form.  Adding formids="login" does fix it but I have 
a lot of places where formid was not set and it worked prior to 3.5.1.  Here's 
the jsp snippet:

<s:form name="login" action="login!login" namespace="/" method="post" 
focusElement="userId" validate="false">
<sj:div id="page_header" >
<table>
    <tr><td><s:label labelSeparator=":" key="global.userId" cssClass="avada-label" /></td>
    <td><s:textfield id="userId" name="userId" size="20" maxlength="64" cssClass="avada-widget" /></td></tr>
    <tr><td><s:label labelSeparator=":" key="global.password" cssClass="avada-label" /></td>
    <td><s:password id="password" name="password" size="20" maxlength="36" cssClass="avada-widget" /></td></tr>
    <tr>
    <td></td>
    <td style="align:right;text-align:right">
     <sj:submit id="login_btn"
            button="true"
            dataType="json"
            targets="result_login_btn" 
            value="%{getText('global.login')}" 
            title="%{getText('global.login')}"
            timeout="20000" 
            indicator="workingIndicator" 
            effect="highlight" 
            effectOptions="{color : '#222222'}" 
            effectDuration="2000"
            disabled="false"
            onSuccessTopics="login_btn_complete"
            onErrorTopics="login_btn_error"
            cssClass="avada-button avada-button-ok"/>
    </td></tr>
</table>
</sj:div>
</s:form>

Original comment by da...@kickflipinc.com on 3 Jun 2013 at 2:00