[ 
https://issues.apache.org/jira/browse/WICKET-2150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689046#action_12689046
 ] 

Johan Compagner commented on WICKET-2150:
-----------------------------------------

Ok i didnt know the wizard from top of my head but i looked at it and yes it is 
what i told yesterday.
If you use buttons you shouldnt use the Form.onsubmit() because mixing those is 
a bit weird. You can do that ofcourse if you really want, but better is if you 
use buttons use buttons all the way.

And the wizard is build like that. Because i dont know what you exactly want to 
do in Form.onSubmit()

But it sounds to me that you should do what you do there in 
IWizardStep.applyState() thats the method that should do it stuff before the 
next button will set the next page.

just look at the code:

public final void onClick()
        {
                IWizardModel wizardModel = getWizardModel();
                IWizardStep step = wizardModel.getActiveStep();

                // let the step apply any state
                step.applyState();

                // if the step completed after applying the state, move the
                // model onward
                if (step.isComplete())
                {
                        wizardModel.next();

thats the onclick of the next button. So first it calls applyState() where you 
can do your stuff that you would do in onSubmit()
Then you also can stop it from going to the next (validation failure)

But that said, i am not really against making onSubmit public, buttons also 
have a public onsubmit so to have that is fine by me.
But we cant change that for 1.3



> Wizard executes onSubmit() of wrong nested form
> -----------------------------------------------
>
>                 Key: WICKET-2150
>                 URL: https://issues.apache.org/jira/browse/WICKET-2150
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.3.5, 1.4-RC2
>            Reporter: Dave Schoorl
>             Fix For: 1.3.6, 1.4-RC3
>
>         Attachments: wizard-onsubmit.zip, wizard-patch-1.3.x.txt, 
> wizard-patch-1.4.x.txt, wizard-patch-revised-1.3.x.txt
>
>
> When you have a wizard and the steps in the wizard contain nested forms, the 
> onSubmit() of the next - instead of the current - step's nested form is 
> executed. This is caused by the fact that during the advancing of step A to 
> step B, first the view of A is replaced with the view of B on the wizard's 
> form, and after that, the form's (and nested form's) onSubmit() is called, 
> incorrectly calling the onSubmit() of view B.
> The swapping of the view should happen after the wizard's form (and nested 
> forms) onSubmit() has been called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to