you need to be adding the components to the form.  you're currently adding
them to the page itself.  the component hierarchy is thus broken.  on your
child page, either do getForm().add(foo) [you'll need to expose a getForm
method that returns the form from the parent page] or else on your parent
page (BaseEditPage), setTransparentResolver(true) on the form and add the
form children to the page then.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <st...@whitesquaresoft.com
> wrote:

> Hi all,
>
> Before I go to far trying to prove I have a bug, I thought i'd crowd
> source an answer.
>
> We have a lot of "Edit" pages that have a lot of simmilar structure,
> and what I wanted to do is create a BaseEditPage that contains the
> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
> then extend it into UserEditPage that just adds the fields that are
> editable.
>
> I can get this working as long as I put all the HTML into the
> UserEditPage.html file.
>
> Lets make this simple.  Lets say that BaseEditPage extends
> StandardPage, where StandardPage provides a standard header, footer
> and so all we have to worry about in the BaseEditPage is the "content"
> of the page.
>
> My BaseEditPage html will look like:
>
> <wicket:extend>
> <form wicket:id="form">
>  <div wicket:id="feedback"/>
>  <wicket:child/>
>
>  <input type="button" wicket:id="save"/>
>  <input type="button" wicket:id="cancel"/>
> </form>
> </wicket:extend>
>
> And the BaseEditPage.java is like:
>
> public class BaseEditPage extends StandardPage {
>
> Form form;
> SubmitLink saveButton;
> SubmitLink cancelButton;
> FeedbackPanel feedbackPanel;
>
> public BaseEditPage() {
>   super();
>
>   form = new Form("form");
>
>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> example simple.
>   cancelButton = new SubmitLink("cancel");
>
>   feedbackPanel = new FeedbackPanel("feedback");
>
>   add(form);
>
>   form.add(saveButton);
>   form.add(cancelButton);
>   form.add(feedbackPanel);
> }
> }
>
> Now I create my UserEditPage
>
> public UserEditPage extends BaseEditPage {
>
> RequiredTextField username;
>
> public UserEditPage() {
>    username = new RequiredTextField<String>("username", new
> Model("test-username"));
>
>    add(username);
> }
>
> }
>
> And create the HTML for the page like:
> <wicket:extend>
>  Username: <input type="text" wicket:id="username"/>
> </wicket:extend>
>
>
> When I run this simple example I get a messsage stating:
>    Unable to find component with id 'username' in [MarkupContainer
> [Component id = _extend4]].
>
> My guess is this is an issue processing the sub class due to the fact
> that the <form> tag is still open.
>
> Is there any way to do this, or is this outside the scope of Wicket?
>
> Cheers,
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to