Wicket
  1. Wicket
  2. WICKET-1429

AjaxFormSubmitBehavior doesn't work well with nested forms

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.2
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Windows XP SP2, JDK 1.5, Apache Tomcat 6.0.14

      Description

      Hello everybody,

      I need to know if it's normal I get error when I do that :

      [code="TestPage.java"]
      public class TestPage extends WebPage {

      public TestPage() {
      Form f = new Form("f");
      f.add(new AjaxFormSubmitBehavior("onsubmit") {

      @Override
      protected void onSubmit(AjaxRequestTarget target)

      { throw new UnsupportedOperationException("Not supported yet."); }

      @Override
      protected void onError(AjaxRequestTarget target) { throw new UnsupportedOperationException("Not supported yet."); }

      });
      f.setOutputMarkupId(true);
      add(f);
      }
      }

      [code="TestPage.html"]
      <html>
      <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      </head>
      <body>
      <form wicket:id="f">
      <input type="submit" value="Sumbit"/>
      </form>
      </body>
      </html>

      I get a error message :
      WicketMessage: Exception in rendering component: [MarkupContainer [Component id = f, page = fr.pasteur.sig.wicket.bug.TestPage, path = 0:f.Form, isVisible = true, isVersioned = true]]

      Root cause:

      java.lang.IllegalStateException: form was not specified in the constructor and cannot be found in the hierarchy of the component this behavior is attached to
      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.getForm(AjaxFormSubmitBehavior.java:85)
      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.getEventHandler(AjaxFormSubmitBehavior.java:97)
      at org.apache.wicket.ajax.AjaxEventBehavior.onComponentTag(AjaxEventBehavior.java:108)
      at org.apache.wicket.behavior.AbstractAjaxBehavior.onComponentTag(AbstractAjaxBehavior.java:132)
      at org.apache.wicket.Component.renderComponentTag(Component.java:3807)
      at org.apache.wicket.Component.renderComponent(Component.java:2462)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1411)
      at org.apache.wicket.markup.html.form.Form.onRender(Form.java:1692)
      at org.apache.wicket.Component.render(Component.java:2308)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1297)
      at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1427)
      at org.apache.wicket.Page.onRender(Page.java:1460)
      at org.apache.wicket.Component.render(Component.java:2308)
      at org.apache.wicket.Page.renderPage(Page.java:906)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231)
      at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
      at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243)
      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
      at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)

      Complete stack:

      org.apache.wicket.WicketRuntimeException: Exception in rendering component: [MarkupContainer [Component id = f, page = fr.pasteur.sig.wicket.bug.TestPage, path = 0:f.Form, isVisible = true, isVersioned = true]]
      at org.apache.wicket.Component.renderComponent(Component.java:2509)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1411)
      at org.apache.wicket.markup.html.form.Form.onRender(Form.java:1692)
      at org.apache.wicket.Component.render(Component.java:2308)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1297)
      at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1427)
      at org.apache.wicket.Page.onRender(Page.java:1460)
      at org.apache.wicket.Component.render(Component.java:2308)
      at org.apache.wicket.Page.renderPage(Page.java:906)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231)
      at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
      at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243)
      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
      at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)

      If I modify AjaxFormSubmitBehavior("onsubmit") by AjaxFormSubmitBehavior(f, "onsubmit) that work perfecty.

      Best regards.

      Dutrieux

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Duto
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development