The button's onSubmit gets called, but not the form's onSubmit that the
button is a part of. That's what i can't figure out as the javadoc says it
should only submit the inner form.

/Steen

2008/1/23, Matej Knopp <[EMAIL PROTECTED]>:
>
> You seem to have a button in your search phone.    <input
> type="submit" wicket:id="searchPhone"/
>
> The button's onSubmit method should be called.
>
> -Matej
>
> On Jan 23, 2008 3:38 PM, Steen Larsen <[EMAIL PROTECTED]> wrote:
> > According to the javadoc for Form it is possible because the inner form
> gets
> > substituted with span tags. It says:
> >
> > <quote>
> > Forms can be nested. You can put a form in another form. Since HTML
> doesn't
> > allow nested <form> tags, the inner forms will be rendered using the
> <div>
> > tag. You have to submit the inner forms using explicit components (like
> > Button or SubmitLink), you can't rely on implicit submit behavior (by
> using
> > just <input type="submit"> that is not attached to a component).
> > </quote>
> >
> > It is mentioned in other threads, I just don't know what I do wrong.
> >
> > /Steen
> >
> > 2008/1/23, James Carman <[EMAIL PROTECTED]>:
> >
> > >
> > > 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
> > > >
> > >
> >
>
>
>
> --
> Resizable and reorderable grid components.
> http://www.inmethod.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to