Aargh, wasn't aware of that.
Thanks.

On Fri, Aug 9, 2013 at 9:33 AM, Martin Grigorov <mgrigo...@apache.org>wrote:

> Hi,
>
> This is how the browsers work. If there is one form element then ENTER
> submits, otherwise - no.
>
> You can register a listener on the form for keyup events that checks the
> keyCode and on ENTER does: $('#buttonId').trigger('click')
>
>
> On Thu, Aug 8, 2013 at 6:13 PM, Jochen Mader <pflanzenmoer...@gmail.com
> >wrote:
>
> > Wicket 6.9.1:
> > I ran into a weird issue:
> > I am trying to submit a form when pressing enter. Using
> > the AjaxFormValidatingBehavior (same for AjaxFormSubmitBehavior) I can
> > submit a form with a SINGLE FormComponent.
> > When adding a second one the form won't submit when pressing enter.
> >
> > Sourcecode below shows what I am doing. Removing the DateTextField makes
> > the whole thing work:
> >
> >
> > Form<Task> form = new Form<Task>("taskForm", new
> > CompoundPropertyModel<Task>(new Task())) {
> >             @Override
> >             protected void onSubmit() {
> >                 taskListModel.getObject().addTask(getModelObject());
> >                 setModelObject(new Task());
> >                 send(getPage(), Broadcast.EXACT, new TaskCreatedEvent());
> >             }
> >         };
> >
> >
> >         add(new
> >
> >
> FeedbackPanel(FEEDBACK).setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true));
> >         add(form
> >                 .add(new TextField<String>("title").setRequired(true))
> >                 .add(new DateTextField("dueDate").add(new DatePicker()))
> >                 .add(new
> Button("submit").add(hideIf(javascriptEnabled())))
> >         );
> >         add(new AjaxFormValidatingBehavior(form, "onsubmit"));
> >
> >
> > <wicket:panel>
> >         <div wicket:id="feedback"></div>
> >         <form wicket:id="taskForm">
> >             <fieldset>
> >                 <legend><wicket:message
> > key="taskForm"></wicket:message></legend>
> >                 <label wicket:for="title"><wicket:label
> > key="title"></wicket:label></label>
> >                 <label wicket:for="dueDate"><wicket:label
> > key="dueDate"></wicket:label></label>
> >                 <input type="text" wicket:id="title"/>
> >                 <input type="text" wicket:id="dueDate"/>
> >                 <input type="submit" wicket:id="submit"/>
> >             </fieldset>
> >         </form>
> >     </wicket:panel>
> >
>

Reply via email to