wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerrit Scholz | QUERPLEX.de" <gerrit.sch...@querplex.de>
Subject AW: jQuery form validation with wicket ajax
Date Tue, 14 Feb 2012 14:06:14 GMT
If I intercept the onclick event my function is called but the processing not stop. Mean that
the wicket (onclick) javascript is running parallel.
So I write a AttributeModifier that prepends my function to the onclick attribute. Now the
validation works fine, but on the onSubmit method of the wicket ajax button the AjaxRequestTarget
is null so the component to refresh cannot be added.

Gerrit

-----Ursprüngliche Nachricht-----
Von: Paul Jackson [mailto:Paul.Jackson@cdl.co.uk] 
Gesendet: Dienstag, 14. Februar 2012 10:38
An: users@wicket.apache.org
Betreff: RE: jQuery form validation with wicket ajax

Thanks for that link! I never managed to work out how to get jquery events to override the
buttons onClick attribute. This should simplify our validation code a lot.

Paul

-----Original Message-----
From: Alec Swan [mailto:alecswan@gmail.com]
Sent: 13 February 2012 16:38
To: users@wicket.apache.org
Subject: Re: jQuery form validation with wicket ajax

This thread describes a purely client-side solution to your problem:
http://stackoverflow.com/questions/1506729/how-to-intercept-the-onclick-event.
You can solve this problem for all you AJAX links by assigning them a special class, e.g.
class="ajaxLink", and then apply the technique to $("form .ajaxLink").

On Mon, Feb 13, 2012 at 3:55 AM, Paul Jackson <Paul.Jackson@cdl.co.uk> wrote:
> 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:gerrit.scholz@querplex.de]
> Sent: 13 February 2012 10:18
> To: users@wicket.apache.org
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------------
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
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message