[
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/[email protected]/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