I have a new problem with a Form and the BACK button.
Take this kind of FORM:
public SearchSomethingForm() {
super(ORSAWebConstants.FORM);
setModel(new CompoundPropertyModel<Void>(this));
add(section01Panel);
add(section02Panel);
add(section03Panel);
add(new SubmitButton());
}
As you see, I don’t have a property model base on a single Object.
Inside the form I only add some panel with some INPUT inside. For Example:
private String name;
protected void onInitialize() {
super.onInitialize();
final TextField<String> foo = new TextField<String> ("name",new PropertyModel<String>(this,"name"));
add (foo);
}
Every Panel code has something like that. Some input with a BIND to a local Property.
Then in FORM SUBMIT, I can read the value with
section01Panel.getName();
PROBLEM
After the form submit, I open a new Page with result. I want a BACK button to the FORM’s Page with every pre-entered field already compiled so the user has only to change a portion of form to make a new search.
Without a specific PropertyModel, I can’t compile the Object with its property mapped on form fields. The Form doesn’t Know which kind of FIELD will be added.
How can I resolve this?
After some test I discovered that Wicket can pass entire page from pages so when I call the new page, I pass the form page:
In the SheetPage I will have a LINK to the previous page:
When I return to FormPage, I will find the page as was before opening the sheet page with form entirely pre-compiled. Awesome!