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

The Ajax reponse of an AjaxSubmitButton creates invalid XHTML markup for multipart forms

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 7.6.0, 6.26.0
    • Fix Version/s: 6.27.0, 7.7.0, 8.0.0-M5
    • Component/s: wicket
    • Labels:
    • Environment:
      Jetty 9, Fedora 25
    • Flags:
      Patch

      Description

      My web pages are delivered as XHTML5 (response.setContentType("application/xhtml+xml");). When I add a multipart form and submit a file, I get strange JavaScript errors about invalid or illegal strings.

      Wicket.Ajax: An error occurred while executing Ajax request:SyntaxError: An invalid or illegal string was specified
      XML Parsing Error: mismatched tag. Expected: </iframe>.
      Address:
      Row Nr. 1, Column 202:

      I found out that Wicket’s Ajax code is responsible for those problems.

      wicket-ajax-jquery.js, row 70
      createIFrame = function (iframeName) {
        var $iframe = jQuery('<iframe name="'+iframeName+'" id="'+iframeName+
          '" src="about:blank" style="position: absolute; top: -9999px; left: -9999px;">');
        return $iframe[0];
      };
      

      The iframe tag isn’t closed. This is fine for HTML5, but not for XHTML5.

      I have attached a quite minimal Wicket project were the problems can be examined:

      mkdir wicket-ajax-jquery-iframe
      mv wicket-ajax-jquery-iframe.zip wicket-ajax-jquery-iframe
      cd wicket-ajax-jquery-iframe
      unzip wicket-ajax-jquery-iframe.zip
      mvn package
      mvn jetty:run-war
      

      Open your browser’s console and upload any file on localhost:8080.

      A patch which fixes this issued is attached. Thanks for your help.

        Attachments

        1. wicket-ajax-jquery.patch
          0.7 kB
          Marcus
        2. wicket-ajax-jquery-iframe.zip
          21 kB
          Marcus

          Activity

            People

            • Assignee:
              svenmeier Sven Meier
              Reporter:
              mhusar Marcus
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: