[
https://issues.apache.org/jira/browse/WICKET-5594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sven Meier updated WICKET-5594:
-------------------------------
Description:
Overriding AjaxButton's hook #onSubmit() is prone to possible programming
errors:
- with JavaScript enabled, #onSubmit() will not be called, leaving the
developer without clue that the wrong method was overwritten
- with JavaScript disabled, #onSubmit(ART, Form) will not be called -
furthermore if the markup includes type="submit" or no type attribute,
#onSubmit() will be called instead.
#onError() and #onError(ART, Form) have identical intricacies.
To make things consistent I propose the following change for Wicket 7.x:
- declare #onSubmit() and #onError() final on AjaxButton
- in #onComponentTag() make sure the <button>-Tag has type="button", so the
browser does not submit the form when JavaScript is disabled. For fallack
support we have AjaxFallbackButton already.
Any objections or better ideas?
was:
When a developer overrides AjaxButton's #onSubmit() and #onError() (note no ART
argument), these hooks will never be called.
Modifying these as final will prevent this possible programming error.
Summary: AjaxButton #onSubmit() #onError() intricacies (was:
AjaxButton prevent override of #onSubmit() #onError())
> AjaxButton #onSubmit() #onError() intricacies
> ---------------------------------------------
>
> Key: WICKET-5594
> URL: https://issues.apache.org/jira/browse/WICKET-5594
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 7.0.0-M1
> Reporter: Sven Meier
> Assignee: Sven Meier
> Priority: Trivial
>
> Overriding AjaxButton's hook #onSubmit() is prone to possible programming
> errors:
> - with JavaScript enabled, #onSubmit() will not be called, leaving the
> developer without clue that the wrong method was overwritten
> - with JavaScript disabled, #onSubmit(ART, Form) will not be called -
> furthermore if the markup includes type="submit" or no type attribute,
> #onSubmit() will be called instead.
> #onError() and #onError(ART, Form) have identical intricacies.
> To make things consistent I propose the following change for Wicket 7.x:
> - declare #onSubmit() and #onError() final on AjaxButton
> - in #onComponentTag() make sure the <button>-Tag has type="button", so the
> browser does not submit the form when JavaScript is disabled. For fallack
> support we have AjaxFallbackButton already.
> Any objections or better ideas?
--
This message was sent by Atlassian JIRA
(v6.2#6252)