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

MarkupContainer.streamChildren() not working with form?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 8.6.1
    • None
    • wicket
    • None
    • Tomcat 8.5

    Description

      Hi,

      not sure if it is an error, but do me it seems a strange behavior. It seems to me that if there is a form in the a container the stream for streamChildren() stops.

      Code StreamChildrenPage.java

      public class StreamChildrenPage extends WebPage {public StreamChildrenPage() {
      WebMarkupContainer cont1 = new WebMarkupContainer("container1");
      cont1.add(new Label("label1", Model.of("Label 1")));
      Form<Void> form = new Form<Void>("form");
      cont1.add(form);
      form.add(new TextField<String>("text", Model.of("")));
      add(cont1);
      WebMarkupContainer cont2 = new WebMarkupContainer("container2");
      cont2.add(new Label("label2", Model.of("Label 2")));
      add(cont2);
      add(new Label("label3", Model.of("Label 3")));
      }

      @Override
      protected void onInitialize() {
        super.onInitialize();
        streamChildren().forEach(t ->

      { System.out.println(t.getClass() + " id: " + t.getId()); }

      );

      }

      Code StreamChildren.html:

      <!DOCTYPE html>
      <html xmlns:wicket="http://wicket.apache.org">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      </head>
      <body>
      <div wicket:id="container1">
        <div wicket:id="label1" ></div>
        <form wicket:id="form">
      <input wicket:id="text" />
      </form>
        </div>}}
      <div wicket:id="container2">
        <div wicket:id="label2" ></div>
        </div>
      <div wicket:id="label3" ></div
      </body>}}
      </html>

      Output:

      class org.apache.wicket.markup.html.WebMarkupContainer id: container1
      class org.apache.wicket.markup.html.basic.Label id: label1
      class org.apache.wicket.markup.html.form.Form id: form
      class org.apache.wicket.markup.html.form.TextField id: text

      If  form (and TextField) are not added in java (and removed from html) the following output is obtained:

      class org.apache.wicket.markup.html.WebMarkupContainer id: container1
      class org.apache.wicket.markup.html.basic.Label id: label1
      class org.apache.wicket.markup.html.WebMarkupContainer id: container2
      class org.apache.wicket.markup.html.basic.Label id: label2
      class org.apache.wicket.markup.html.basic.Label id: label3
      class org.apache.wicket.markup.html.internal.HtmlHeaderContainer id: header

      Am I missing something?

      Thanks,

      Helmut

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              helmut8080 Helmut Lerch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: