http://www.thescripts.com/forum/thread95602.html


On 1/23/08, Steen Larsen <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have seen that nested forms should be possible in Wicket 1.3, so i have
> tried to use it in one of my projects, but for some reason when submitting
> the inner form, only the outer form submit method is run. The code looks
> something like this:
>
> In a WebPage class
>
>         MandatoryProductsForm form = new
> MandatoryProductsForm("mandatoryProductsForm");
>         add(form);
>         Order order = getOrder();
>         form.setModel(new CompoundPropertyModel(order));
>         NewPhoneForm pForm = new NewPhoneForm("phoneForm");
>         pForm.add(new Button("searchPhone"));
>         form.add(pForm);
>
> where the forms are
>
>     class MandatoryProductsForm  extends Form {
>         MandatoryProductsForm(String s) {
>             super(s);
>         }
>
>         protected void onSubmit() {
>             Order order = (Order) getModelObject();
>             System.err.println("pn = " + order.getNewPhoneNumber());
>             setOrder(order);
>             setResponsePage(AdditionalProducts.class);
>         }
>     }
>
>     class NewPhoneForm  extends Form {
>         NewPhoneForm(String s) {
>             super(s);
>         }
>
>         protected void onSubmit() {
>             System.err.println("Submit inner form");
>         }
>     }
>
> and the html is
>
> <form wicket:id="mandatoryProductsForm">
>        <form wicket:id="phoneForm">
>               <input type="submit" wicket:id="searchPhone"
> value="S&oslash;g"/>
>        </form>
>        <input type="submit" name="continue" value="Videre">
> </form>
>
> when pressing the searchPhone button I would expect the NewPhoneForm's
> onSubmit method to be run but that doesn't happen. Anyone know why ?
>
> /Steen
>

Reply via email to