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: [email protected]
For additional commands, e-mail: [email protected]