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

Submitting a form with Ajax in WicketTester does not check if form is multiPart

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.7
    • Fix Version/s: 1.5.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      any

      Description

      While executing wicketTester.executeAjaxEvent(butooon, "onclick")
      i get ServletRequest does not contain multipart content. One possible solution is to explicitly call Form.setMultipart(true), Wicket tries its best to auto-detect multipart forms but there are certain situation where it cannot.

      executeAjaxEvent method does not check if form is multiPart. To workaround this problem before executeAjaxEvent we can execute:
      MockHttpServletRequest servletRequest = wicketTester.getServletRequest();
      servletRequest.setUseMultiPartContentType(true);
      But its annoying to set this flag again and again. Could you extend executeAjaxEvent to check if form is multiPart ? Similar checking is already done in FormTester.onSubmit().

        Activity

        Hide
        ktotut Ruslan Shyposha added a comment -

        Although it's probably not really Major, the issue is still there with 1.5-RC5.1.

        Show
        ktotut Ruslan Shyposha added a comment - Although it's probably not really Major, the issue is still there with 1.5-RC5.1.
        Hide
        mgrigorov Martin Grigorov added a comment -

        With r1162567 if the ajax behavior is AjaxFormSubmitBehavior its form will be used to set the multi part hint.

        Let us know if this is not enough, because the old title of this ticket was about "executeAjaxEvent()" which is not always related to form submittion.

        Show
        mgrigorov Martin Grigorov added a comment - With r1162567 if the ajax behavior is AjaxFormSubmitBehavior its form will be used to set the multi part hint. Let us know if this is not enough, because the old title of this ticket was about "executeAjaxEvent()" which is not always related to form submittion.

          People

          • Assignee:
            mgrigorov Martin Grigorov
            Reporter:
            mikel Michał Letyński
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development