Hi,

when you move to the previous step, the form inside of the wizard is not processed, thus the user input is preserved until next rendering. Later one when you move to this step once again, the still present user input takes precedence over the current values in the model object.

Solution:

            add(new PreviousButton("previous", wizard) {
                @Override
                public void onClick() {
                    // don't keep input when going back
                    getForm().clearInput();

                    super.onClick();
                }
            });

BTW you should move the following code in SelectEmployeeStep:

            @Override
            protected void onSubmit() {
employee.setEntry2(employee.getAppointment_type()); // default for next step
            }

... to an overriden #applyState():

    @Override
    public void applyState() {
employee.setEntry2(employee.getAppointment_type()); // default for next step
    }

This way you don't have to mess with calling #process() by yourself in RequestWizard#MyButtonBar which is rather awkward. Furthermore you don't need to have forms inside your steps actually, since Wizard itself has a form already.

Have fun
Sven


On 15.01.2016 21:09, trlt wrote:
Hi all,

There is probably something very fundamental that I don't in wicket models.
Attached is a very simple quickstart to illustrate my problem.

In it, I have a 2-step wizard program:

1) Select "Faculty" from the Appointment Type drop down in step 1;
2) Show what's been selected (works as expected) in "Next" step;
3) Now go back to Select "Staff" from the Appointment Type drop down using
"Previous" button;
4) Label works, but the drop down doesn't (the value stays with same).

I've tried various way to update the model, but to no avail. Hope someone
can shed some light on this for me. Thanks! quickstart.zip
<http://apache-wicket.1842946.n4.nabble.com/file/n4673357/quickstart.zip>

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-model-update-in-a-wizard-program-tp4673357.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to