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

Ajax buttons inside ModalWindows don't submit properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.4
    • 1.4.5, 1.5-M1
    • None
    • None

    Description

      I have a ModalWindow that contains an IndicatingAjaxButton. When I click the button, I get a big Java error complaining that the form submit wasn't multipart.

      Digging into the javascript in wicket-ajax.js, I found this from line 1102 in the method handleMultipart

      multipart=multipart||form.enctype=="multipart/form-data";
      
      if (multipart==false) {
           // nothing to handle
          return false;
       }
      

      When this executed, multipart was false, and enctype was "" and therefore the submit aborted. This may be the cause.

      Here's the Java stacktrace

      java.lang.IllegalStateException: ServletRequest does not contain multipart content
      	at org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest.<init>(MultipartServletWebRequest.java:113)
      	at org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest.<init>(MultipartServletWebRequest.java:83)
      	at org.apache.wicket.extensions.ajax.markup.html.form.upload.MultipartRequest.<init>(MultipartRequest.java:41)
      	at org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadWebRequest.newMultipartWebRequest(UploadWebRequest.java:66)
      	at org.apache.wicket.markup.html.form.Form.handleMultiPart(Form.java:1651)
      	at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:850)
      	at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:135)
      	at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:177)
      	at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
      	at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:119)
      	at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
      	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
      	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
      	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
      	at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
      	at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
      	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      

      Attachments

        1. wicket-2621-sample-app.zip
          6.02 MB
          Alex Grant

        Activity

          People

            ivaynberg Igor Vaynberg
            alexgrant Alex Grant
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: