I am also in the 'separate forms - separate submits' camp. It is probably easier to call the submit for the inside form using a child visitor than it is to circumvent it.
The reason is: encapsulation. The nested form is a separate unit of work. And what would you do if you have 3 or 4 forms nested? Call them all? Which one would 'win' if a setResponsePage() was done? Martijn On 11/5/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
Well, nothing is carved into stone. If more people think that the forms should be treated as separate, so be it. Do you think there should be a vote? If so can someone formulate one? -Matej Johan Compagner wrote: > hmm, i don't know. > its a difficult one. > > I think they are really separate you could implement it this way that > really > only the form is submitted. > > For example i have a Search Form component that is in my outer form. > and that form has really standalone behavior. if you fill in the field and > press search then something is searched for > But the outer form is editing data so if i submit that form i really don't > want to search. > > That kind of example make me choose for only call the submit of the form > that is really submitted > if it is outer or inner.. > > johan > > > > On 11/4/06, Matej Knopp <[EMAIL PROTECTED]> wrote: >> >> Johan Compagner wrote: >> > what do you mean extend the inner form? as in java extend? >> > Why should you do that as developer. then just have one form. What does >> > that >> > inner do then? >> > >> > It should be just 2 seperate forms (on the java side) >> > and if possible we should know what button (so what form) is submitted >> so >> > that only one is processed >> > The other should keep the rawinput for the next render. >> Yeah. This is basically what currently happens. The question is, when >> outer form is submitted, what should the nested form do. I personally >> think that it should be processed to. There is a parent-child >> relationship, they are not isolated. >> >> If you have form a, and then form b and c inside a, you submit b, the >> form c should not be processed (though rawinput should be kept). >> >> But if you submit a, I think that both b and c should be processed. >> >> -Matej >> > >> > johan >> > >> > >> > On 11/4/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote: >> >> >> >> hmm.. I like that idea. If this is a wicket only thing, you might want >> to >> >> let the programmer decide what should be happening.. perhaps the >> outer >> >> form >> >> has to extend the inner one if it should be act like 1 big form, if >> you >> >> dont extend it, they are acting as 2 own forms instead? >> >> >> >> Regards >> >> >> >> > -----Ursprüngliche Nachricht----- >> >> > Von: Matej Knopp [mailto:[EMAIL PROTECTED] >> >> > Gesendet: Samstag, 4. November 2006 18:38 >> >> > An: [email protected] >> >> > Betreff: Re: AW: Nested forms >> >> > >> >> > Indeed, nesting html forms it not allowed. Therefore we have >> >> > nested forms support in 2.0. If you nest form copmonents, the >> >> > inner <form tags will be replaced by <div>s. >> >> > >> >> > When the inner form is submitted, it actually means >> >> > submitting the outerform, but only the fieds from inner form >> >> > will be validated and updated. >> >> > >> >> > -Matej >> >> > >> >> > Korbinian Bachl wrote: >> >> > > Emm, Martinj, >> >> > > >> >> > > im not sure but as far as I know, nested forms are not allowed in >> >> > > HTML3, 4 and XHTML 1.0 and 1.1. Furthermore, as its not allowed >> you >> >> > > dont know what the browser will do. >> >> > > >> >> > > Regards >> >> > > >> >> > >> -----Ursprüngliche Nachricht----- >> >> > >> Von: Martijn Dashorst [mailto:[EMAIL PROTECTED] >> >> > >> Gesendet: Samstag, 4. November 2006 17:49 >> >> > >> An: Wicket Development >> >> > >> Betreff: Nested forms >> >> > >> >> >> > >> I was surprised to see the nested forms working, but I have a >> >> > >> question on what happens with the inner form inputs when the >> outer >> >> > >> form is >> >> > >> submitted: >> >> > >> >> >> > >> <form wicket:id="outer"> >> >> > >> <input type="text" wicket:id="field" /> >> >> > >> <form wicket:id="inner"> >> >> > >> <input type="text" wicket:id="field" /> >> >> > >> <input type="submit" wicket:id="innerSave" /> >> >> > >> </form> >> >> > >> <input type="submit" wicket:id="outerSave" /> </form> >> >> > >> >> >> > >> public class MyPage extends WebPage { >> >> > >> private String inner; >> >> > >> private String outer; >> >> > >> >> >> > >> public MyPage() { >> >> > >> Form outer = new Form(this, "outer"); >> >> > >> new TextField(outer, "field", new PropertyModel(this, >> >> > >> "outer")); >> >> > >> Form inner = new Form(outer, "inner"); >> >> > >> new TextField(inner, "field", new PropertyModel(this, >> >> > >> "inner")); >> >> > >> new Button(outer, "outerSave") {}; >> >> > >> new Button(inner, "innerSave") {}; >> >> > >> } >> >> > >> } >> >> > >> >> >> > >> If the user clicks the inner button, only the inner fields are >> >> > >> processed. >> >> > >> >> >> > >> If the user clicks the outer button, both the inner and >> >> > outer fields >> >> > >> are processed, but the inner forms 'onSubmit' is not called. >> >> > >> >> >> > >> Two questions: >> >> > >> 1. should the inner fields be processed and update their models? >> >> > >> 2. should the inner onSubmit/onError be called when the outer is >> >> > >> submitted? >> >> > >> >> >> > >> Martijn >> >> > >> -- >> >> > >> <a >> >> > >> >> >> > >> href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a> >> >> > >> for <a >> >> > >> >> >> > href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a> >> >> > >> at the <a href="http://www.thebeststuffintheworld.com/">Best >> >> > >> Stuff in the World!</a> >> >> > >> >> >> > > >> >> > > >> >> > >> >> > >> >> >> >> >> > >> >> >
-- <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in the World!</a>
