Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2553

Wicket-ajax.js: Javascript error on submitting of form with wicketSubmitFormById.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.2, 1.4.3
    • Fix Version/s: 1.4.4, 1.5-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      In SVN revision 815602 (http://www.mail-archive.com/commits@wicket.apache.org/msg13879.html) some new code is added.

      This introduces a new bug where a null button is added to the form. This gives an error in Safari and Firefox and results in a form that doesn't submit.

       
                     if (submitButton!=null) {
                             try {
                             var btn = document.createElement("<input type='hidden' 
      name='"+submitButton+"' id='"+iframe.id+"-btn' value='1'/>");
                             } catch (ex) {
                                 var btn = document.createElement("input");
                                 btn.type="hidden";
                                     btn.name=submitButton;
                                     btn.id=iframe.id+"-btn";
                                     btn.value="1";
                             }
                     }
                     form.appendChild(btn);
      

      In the code above, form.appendChild(btn) is called. In my case, the btn is not created yet, because the "if" statement is skipped (submitButton == null).

      This results in an error.

      I think the form.appendChild(btn) line needs to be inside the "if" block, so it is not called when the btn does not exist.

        Attachments

          Activity

            People

            • Assignee:
              ivaynberg Igor Vaynberg
              Reporter:
              stuq Daan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: