Hi,

the values of all form components are submitted, but only the ones from the submitted nested form are processed.

See Form#wantSubmitOnNestedFormSubmit() and the tests in NestedFormSubmitTest.

Sven


On 04/02/2013 12:40 PM, RalfButler wrote:
Hi there,

to my understanding the forms in the bottom code are nested. But why is the
value of the outer textbox submitted when I click the inner submit button
only? According to this  page
<https://cwiki.apache.org/WICKET/nested-forms.html>   only the value of the
inner textbox should be submitted when the inner submit button is pressed.

Would be great if someone could explain this. Most likely I do something
wrong here.

Thanks.
Ralf


public class HomePage extends WebPage {

     private static final long serialVersionUID = 1L;
     private Model innerModel= new Model("Inner");
     private Model outerModel= new Model("Outer");

     public HomePage() {

         add(new Label("labelOuter", outerModel));
         add(new Label("labelInner", innerModel));
         Form formA = new Form("outerForm"){

             @Override
             protected void onSubmit() {
                 System.out.println("Outer form submitted");
             }
};
         add(formA);
         formA.add(new TextField("outerFormTF", outerModel));
         Form formB = new Form("innerForm"){

             @Override
             protected void onSubmit() {
                 System.out.println("Inner form submitted");
             }
};
         formA.add(formB);
         formB.add(new TextField("innerFormTF", innerModel));

     }
}

HTML:
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org";>
     <head>
         <meta charset="utf-8" />
         <title>Apache Wicket Quickstart</title>
         <link
href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold'
rel='stylesheet' type='text/css' />
         <link rel="stylesheet" href="style.css" type="text/css"
media="screen" title="Stylesheet" />
     </head>
     <body>
         Outer value <br/>
         Inner value
         <form wicket:id="outerForm">
             <input wicket:id="outerFormTF" type="text"/>
             <input type="submit" value="Outer Form" />
             <form wicket:id="innerForm">
                 <input wicket:id="innerFormTF" type="text"/>
                 <input type="submit" value="Inner Form" />
             </form>
         </form>
     </body>
</html>




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Nested-forms-tp4657683.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to