[
https://issues.apache.org/jira/browse/WICKET-7140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17914008#comment-17914008
]
ASF GitHub Bot commented on WICKET-7140:
----------------------------------------
martin-g commented on PR #1076:
URL: https://github.com/apache/wicket/pull/1076#issuecomment-2597719508
A warning about `Wicket.Form` - see
https://github.com/apache/wicket/blob/c91e34a90234bc091939c27fcc1716f710af5274/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1128
It might be tricky to add a new function to it!
Currently `Wicket.Form` is contributed by wicket-ajax.js, i.e. only then
there is an Ajax behavior in the page.
I guess the new function is needed even when there is no need of Ajax.
It would have been better to namespace everything in wicket-ajax.js in
Wicket.Ajax.** but it is too late now ...
> Form submit triggered by pressing return in textareas
> -----------------------------------------------------
>
> Key: WICKET-7140
> URL: https://issues.apache.org/jira/browse/WICKET-7140
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 10.3.0
> Reporter: Thomas Heigl
> Priority: Major
> Attachments: wicket-bug.zip
>
>
> Since upgrading to Wicket 10.3.0, pressing return in a textarea submits the
> form when a `form.setDefaultButton()` is set. Downgrading to 10.2.0 fixes the
> problem.
> Minimal reproducer:
> {code:java}
> public class HomePage extends WebPage {
> public HomePage(final PageParameters pp) {
> super(pp);
> final Form<?> form = new Form<>("form");
> form.add(new TextArea<>("textArea", new Model<>()));
> final AjaxSubmitLink link = new AjaxSubmitLink("submit") {
> @Override
> protected void onSubmit(AjaxRequestTarget target) {
> target.appendJavaScript("alert('Submitted');");
> }
> };
> form.add(link);
> form.setDefaultButton(link);
> add(form);
> }
> } {code}
> Click into the textarea and press return/enter.
> See also the attached quickstart.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)