Cool, thanks!

How about browser support for this? We've tested with current Firefox and Chrome releases and it works like a charm. But how about IE < 9 ?

Op 2-11-2011 12:33, schreef Martin Grigorov:
On Wed, Nov 2, 2011 at 1:29 PM, Bas Gooren<[email protected]>  wrote:
Hi,

Yes we currently do

form.add( new AjaxFormSubmitBehavior(form, "onsubmit"));

I've been testing what you describe (enter keys calls submit button), and
this works.
99% of the time we only have one submit button, so that's good enough for
us.
You can use 
org.apache.wicket.markup.html.form.Form.setDefaultButton(IFormSubmittingComponent)
if you have two or more submitting buttons.

Thanks!

Op 1-11-2011 23:54, schreef Andrea Del Bene:
Hi,

if your form has just one submitting button, pressing enter key on a field
should submit it by default. Anyway, I would solve this problem using a
JavaScript library like JQuery rather then using a Wicket Ajax behavior. Can
you give us more details about your AjaxFormSubmitBehavior? Are you using it
like this:

form.add( new AjaxFormSubmitBehavior("onsubmit"))
Hi all,

To handle the case where somebody hits enter in a form field which has an
(Ajax)Button to submit the entire form by ajax, we used an
AjaxFormSubmitBehavior attached to the form's onsubmit in wicket 1.4.x

After upgrading to 1.5 our ajax indicator was not hidden after the ajax
request, wich asked for some investigating.

It turns out, this is what happens:
- onsubmit is called by browser and calls wicketSubmitFormById()
- that method calls Wicket.Ajax.Call.SubmitForm() which in turn calls
onsubmit again

The issue with the ajax indicator image remaining visible is simply due
to showIncrementally being called twice, and hideIncrementally only once.

But let's ignore that for now, the bigger issue is how do we properly
handle this use case? We chose a form onsubmit handler to prevent adding an
onKeyUp handler (and checking for enter key) to all form fields, as this
seems more elegant.
Having the form's onsubmit delegate to the ajaxbutton will create the
exact same problem: a loop.

How do others solve this in 1.5?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Reply via email to