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>




Reply via email to