You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "James McIntosh (JIRA)" <ji...@apache.org> on 2012/05/29 03:46:22 UTC

[jira] [Created] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

James McIntosh created WICKET-4575:
--------------------------------------

             Summary: AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
                 Key: WICKET-4575
                 URL: https://issues.apache.org/jira/browse/WICKET-4575
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.0
            Reporter: James McIntosh


I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).

In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.

I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.

I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:

new AjaxFormSubmitBehavior(form, "onclick") {

	boolean formSubmited;

	protected void onEvent(AjaxRequestTarget target) {
		formSubmited = false;
		super.onEvent(target);
		if (formSubmited) {
			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
		}
	}
	
	protected void onSubmit(AjaxRequestTarget target) {
		formSubmited = true;
		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
 	}
 	
 	...
 	
}

and add an onBeforeSubmit method to the AjaxButton.

protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
}

The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().


Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.

AjaxWizard issue:
http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
AjaxButton issue:
http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel updated WICKET-4575:
-------------------------------------

    Remaining Estimate: 0h
     Original Estimate: 0h
    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel updated WICKET-4575:
-------------------------------------

    Fix Version/s: 1.5.8
    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel resolved WICKET-4575.
--------------------------------------

    Resolution: Fixed
    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396808#comment-13396808 ] 

Martin Grigorov commented on WICKET-4575:
-----------------------------------------

Copy my comments from dev@ mailing list:

Looks OK to me.

Just a few minor things:

1) I prefer on(Before|After)FormSubmit than
onSubmit(Before|After)Form. Sounds more clear to me

2) I see you removed 'abstract' from the methods.
I agree that it will be worse if I have to override both new methods
for every Link/Button I use. But I also remember that in earlier
versions of Wicket #onSubmit() was abstract and #onError() wasn't and
some people complained about this. I think #onError() became abstract
for 1.5.x.
We just need to decide which way to go here.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel updated WICKET-4575:
-------------------------------------

    Affects Version/s: 6.0.0-beta2
        Fix Version/s: 6.0.0-RC1
    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13395771#comment-13395771 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

Hm. I guess we could deprecate IFormSubmitter#onSubmit in both 1.5 and 6.0, and add onBeforeFormSubmit and onAfterFormSubmit (in IFS for 6.0 and in a temp interface in 1.5). For the time being, #onSubmit could be called together with onBeforeFormSubmit (which is what is happening today).
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401113#comment-13401113 ] 

Pedro Santos commented on WICKET-4575:
--------------------------------------

It's natural to expect that IFormSubmitter#onSubmit will be invoked before the form's one. IMO a better API would be:
 
public interface IFormSubmitter{
	void onSubmit();  <-- keeps the current signature
	void onAfterSubmit(); <-- adding the exception case. Also onAfterFormSubmit sounds a pleonasm
}
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "James McIntosh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393406#comment-13393406 ] 

James McIntosh commented on WICKET-4575:
----------------------------------------

The second option (adding methods without enum) is definitely more elegant.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295682#comment-13295682 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

Okay, 6.0 was easy enough.

Any objections to adding a temporary IOrderedFormSubmitter interface in 1.5?
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel reopened WICKET-4575:
--------------------------------------

    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396822#comment-13396822 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

> 1) I prefer on(Before|After)FormSubmit than
> onSubmit(Before|After)Form. Sounds more clear to me  

I had those first, but it seemed odd - "onBeforeFormSubmit" sounds like
it happens before the submit, like onBeforeRender happens before render.
onSubmitBeforeForm is clearly a part of the submit, just invoked before
the form is called.

> 2) I see you removed 'abstract' from the methods.
> I agree that it will be worse if I have to override both new methods
> for every Link/Button I use. But I also remember that in earlier
> versions of Wicket #onSubmit() was abstract and #onError() wasn't and
> some people complained about this. I think #onError() became abstract
> for 1.5.x.
> We just need to decide which way to go here.  

With the two new methods I don't think any of them should be abstract.
Almost all buttons will only need one of them. In our application the
abstract onError added a lot of noise that we didn't need, and this
would triple it.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295657#comment-13295657 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

Both this and WICKET-1894 present valid use cases, so I think we need to support both. Ideally, each submit button should be able to choose whether it wants to run before or after Form#onSubmit.

In 6.0 this should be easy - I'm going to give IFormSubmitter an additional method #getSubmitOrder to return an enum value, either BEFORE_FORM or AFTER_FORM. The existing buttons can default to return BEFORE_FORM as 1.5 is doing now. Form#delegateSubmit can then simply switch the order around depending on this value.

This would be an API break for 1.5 though. What are good options to add this anyway? We could give 1.5 an additional Interface IOrderedFormSubmitter extends IFormSubmitter, and have all default implementations like AjaxFallbackButton etc implement it. In 6.0 it could be dropped again.

Opinions?
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel resolved WICKET-4575.
--------------------------------------

    Resolution: Fixed

Commited the patches to both 1.5 and 6.0.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401459#comment-13401459 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

I had initially wanted the symmetry of onAfter/onBefore, and the onAfter*Form*Submit part to make it clear that it's not actually "after submit" but "after Form#onSubmit".

Howevery, I now think you're correct. 1.5 has firmly established that IFS#onSubmit is called before Form#onSubmit. So we'll simply add #onAfterSubmit now.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401487#comment-13401487 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

Fixed again in 1.5 and 6.0.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1, 1.5.8
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396801#comment-13396801 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

I have an implementation for both 6.0 and 1.5.

In 1.5 I have deprecated onSubmit and added onSubmitBeforeForm and onSubmitAfterForm in an extension interface.

In 6.0 I have moved onSubmit to onSubmitBeforeForm and added onSubmitAfterForm.

It works, the two methods seem intuitive, so that is nice. The implementation is as simple as I could get it. Still, after talking with martin-g I didn't push it out to the main branches directly, but set up two sandbox branches instead so others can have a look. See sandbox/formsubmit-beforeafter-1.5 and sandbox/formsubmit-beforeafter-6.0.

It's ready to be merged, I'd just like some more comments.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295685#comment-13295685 ] 

Carl-Eric Menzel commented on WICKET-4575:
------------------------------------------

On second thought, having an onBeforeFormSubmit and an onAfterFormSubmit in ISubmittingComponent sounds good too, instead of opting for just one of the two with the enum solution. The drawback is that the old onSubmit method wouldn't make any sense then anymore and should be removed, thus increasing the migration work for all users.

Again, opinions? Which of these is better:
- put the enum-based solution (BEFORE_FORM, AFTER_FORM, currently in master) in 1.5 too?
- drop the enum and change onSubmit to onBeforeFormSubmit and onAfterFormSubmit in 6, and add onAfterFormSubmit in 1.5?
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0, 6.0.0-beta2
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>             Fix For: 6.0.0-RC1
>
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288077#comment-13288077 ] 

Martin Grigorov commented on WICKET-4575:
-----------------------------------------

The change in the order is caused by WICKET-1894.
                
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0
>            Reporter: James McIntosh
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5

Posted by "Carl-Eric Menzel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl-Eric Menzel reassigned WICKET-4575:
----------------------------------------

    Assignee: Carl-Eric Menzel
    
> AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
> -----------------------------------------------------------
>
>                 Key: WICKET-4575
>                 URL: https://issues.apache.org/jira/browse/WICKET-4575
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.0
>            Reporter: James McIntosh
>            Assignee: Carl-Eric Menzel
>
> I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget).
> In 1.4 the code would submit the From.onSubmit() first and then fire the AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to process the AjaxFormSubmitBehavior first.
> I have lots of examples of requiring the AjaxButton to perform "on after submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form submit. These ajax events change the component heirachy so that the form is no longer present, thus never gets submitted e.g. Next button. I have no particular cases where I would want the AjaxButton onSubmit called before the form submit, I'm wondering if there are many at all.
> I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic for other components which use it so I will make a suggestion to modify the AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate the original behaviour:
> new AjaxFormSubmitBehavior(form, "onclick") {
> 	boolean formSubmited;
> 	protected void onEvent(AjaxRequestTarget target) {
> 		formSubmited = false;
> 		super.onEvent(target);
> 		if (formSubmited) {
> 			LegacyAjaxButton.this.onSubmit(target, LegacyAjaxButton.this.getForm());
> 		}
> 	}
> 	
> 	protected void onSubmit(AjaxRequestTarget target) {
> 		formSubmited = true;
> 		LegacyAjaxButton.this.onBeforeSubmit(target, LegacyAjaxButton.this.getForm());
>  	}
>  	
>  	...
>  	
> }
> and add an onBeforeSubmit method to the AjaxButton.
> protected void onBeforeSubmit(AjaxRequestTarget target, Form<?> form) {		
> }
> The other possible solution would be to change the IFormSubmitter to have both an onAfterSubmit() and call it in Form.delegateSubmit().
> Just as a side note, I've noticed some other chatter on mailing lists around this (see below) so thought I would raise it.
> AjaxWizard issue:
> http://www.mail-archive.com/users@wicket.apache.org/msg71273.html
> AjaxButton issue:
> http://comments.gmane.org/gmane.comp.java.wicket.user/96947

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira