[
https://issues.apache.org/jira/browse/WICKET-7140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17914014#comment-17914014
]
ASF GitHub Bot commented on WICKET-7140:
----------------------------------------
theigl commented on PR #1076:
URL: https://github.com/apache/wicket/pull/1076#issuecomment-2597739543
> I see, I just put it into separate file for better readability and not to
create unnecessary duplicated JS code on rendered page if there are multiple
forms. I can still put it back (embed) it in `Form.java` if necessary.
>
> Or maybe create custom namespace like Wicket.Internal.Form or something
like that?
>
> Edit: one more option.
My suggestion would be to keep it as simple as possible. Get rid of the
`form.js` file and all of the submit handling for `textarea` and
`contenteditable` and only react to ENTER presses in `input` fields. Then
everything is simple again and can be rendered inline. If custom ENTER handling
for `textarea` is required, users can add their own simple behavior.
> 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)