On Thu, Dec 23, 2010 at 6:03 PM, Josh Kamau <[email protected]> wrote:

> Hi there;
>
> I would like to implement submitting of forms when the return key is hit
> via
> ajax. Is there away of doing this - I would prefer a solution that doesnt
> involve javascript but any answer is welcome.
>

It's AJAX.  And it's responding to client-side events.  It *will* require
javascript.

That being said, you would use an AjaxFormSubmittingBehavior and use an
ICallDecorator to add the required javascript to listen for the key event.
 Check the key event code to see if it was the return key, and if so, call
the AJAX javascript.

You could also have an ajax form submitting button, and just attach JS to
each form component that takes the return key event and calls
button.click().  If the button is of type="submit", and is the default
button for the form, this behavior is automatic in most (if not all)
browsers.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Reply via email to