I have looked at the examples and the javadocs but can't figure out how
to do the following. I am a wicket newbie.
I want to create a wizard with 2 steps implemented as panels.
Step 1: Asks the user to enter some information. Validates that the
information entered is in the database before moving to step 2. [I have
this working]
Step 2: Based on the information entered in step 1, look in the db for
the matching data and display the rest of the information. [part I am
having trouble with]
This is to implement a forgot password functionality. Based on the
username entered in step 1, look up a question in the db, then display
the question to the user in step 2 so they can answer it. Then after
successfully answering the question perform some logic to reset the
password.
I am just having trouble with the move from Step 1 to Step 2. I assume
the success logic would be implemented in the onFinish() method of my
ForgotPasswordWizard
The code [just displaying the constructors]:
public ForgotPasswordWizard(String id) {
super(id);
ForgotPasswordModel bean = new ForgotPasswordModel();
setDefaultModel(new
CompoundPropertyModel<ForgotPasswordModel>(bean));
WizardModel model = new WizardModel();
model.add(new ForgotPasswordStep1());
model.add(new ForgotPasswordStep2());
init(model);
}
public ForgotPasswordStep1() {
super(new Model("ForgotPasword"), new Model("Enter your
username [email]"));
RequiredTextField username = new
RequiredTextField("username");
username.add(EmailAddressValidator.getInstance());
add(username);
IFormValidator validator = new AccountValidator(username);
this.add(validator);
}
public ForgotPasswordStep2() {
super(new Model("ForgotPasword"), new Model("Answer your
Security Question"));
// ??????????????????????????????????????????????????
// find the question from the db for the user
ForgotPasswordModel myModel = (ForgotPasswordModel)
this.getDefaultModelObject();
// access the db to get the actual question
myModel.setQuestion("[the question I shoud show]);
// ???????????????????????????????????????????????????
add(new Label("question"));
add(new RequiredTextField("answer"));
}
Thanks.
Jeff