We use an OnBeforeRenderListener to add onClick events to the buttons and ajax 
buttons on a form that we want to be validated. We have to handle the normal 
buttons and ajax buttons slightly differently.

Ajax button:

            button.add(new AttributeModifier("onclick", new Model<String>("if 
(! $('#" + formMarkupId
                    + "').validate().form()) {return false};")) {

Normal Button:

            button.add(new WiQueryEventBehavior(new Event(MouseEvent.CLICK) {
                @Override
                public JsScope callback() {
                    return JsScope.quickScope("return $('#" + formMarkupId + 
"').validate().form();");
                }
            }));

Hope that helps.

Paul

-----Original Message-----
From: Gerrit Scholz | QUERPLEX.de [mailto:[email protected]] 
Sent: 13 February 2012 10:18
To: [email protected]
Subject: jQuery form validation with wicket ajax

Hello there,
I try to use jQuery validaton (http://docs.jquery.com/Plugins/Validation) with 
a wicket AJAX button. I register the jQuery validator on the form. If I use a 
normal wicket submit button or link, the jQuery form validation works. But if I 
use an AJAX button or link, the jQuery form validation is not called. How can I 
call the jQuery validation before AJAX update.
Thanks,
Gerrit
 


---------------------------------------------------------------------------
QUERPLEX GmbH Nürnberg | www.querplex.de Kornmarkt 2
D-90402 Nürnberg
---------------------------------------------------------------------------
Tel +49 (0)911 94 11 98 - 0
Fax +49 (0)911 94 11 98 - 59
---------------------------------------------------------------------------
Registergericht Nürnberg HRB 20 123
Geschäftsführerin: Angelika Benkert
---------------------------------------------------------------------------
**********************************************************************
Please consider the environment - do you really need to print this email?

This email is intended only for the person(s) named above and may contain 
private and confidential information. If it has come to you in error, please 
destroy and permanently delete any copy in your possession and contact us on 
+44 (0) 161 480 4420. The information in this email is copyright © CDL Group 
Holdings Limited. We cannot accept any liability for any loss or damage 
sustained as a result of software viruses. It is your responsibility to carry 
out such virus checking as is necessary before opening any attachment.

Cheshire Datasystems Limited uses software which automatically screens incoming 
emails for inappropriate content and attachments. If the software identifies 
such content or attachment, the email will be forwarded to our Technology 
Department for checking. You should be aware that any email which you send to 
Cheshire Datasystems Limited is subject to this procedure.

Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD
Registered in England and Wales with Company Number 3991057
VAT registration: 727 1188 33

Reply via email to