You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Java Programmer <jp...@gmail.com> on 2007/11/23 14:56:55 UTC

Question about JavaScript validation

Hello,
Is there any simple way to generate javascripts to validate forms
against validation rules provided by Wicket Validators e.g.
RequiredValidator? I have on mind client side validators to check is
fields not empty, or provided passwords match. For now I see that Ajax
support is great, but cant find any exaples for common client
javascripts to prevalidate forms - if there are any ready to use, how
can I write my own? Any working examples to see?

Best regards,
Adr

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


Re: Question about JavaScript validation

Posted by Alex Objelean <al...@isdc.ro>.

As far as I know, there is no way to generate js validation script against
wicket validation rules. If you want to add  client side validation, it is
up to you how to do it. There are a dozen of js validation frameworks, so
you can easily integrate them in your web application.

Alex


Java Programmer wrote:
> 
> Hello,
> Is there any simple way to generate javascripts to validate forms
> against validation rules provided by Wicket Validators e.g.
> RequiredValidator? I have on mind client side validators to check is
> fields not empty, or provided passwords match. For now I see that Ajax
> support is great, but cant find any exaples for common client
> javascripts to prevalidate forms - if there are any ready to use, how
> can I write my own? Any working examples to see?
> 
> Best regards,
> Adr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-JavaScript-validation-tf4861904.html#a13918947
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Question about JavaScript validation

Posted by Java Programmer <jp...@gmail.com>.
Thank you for the answers, I agree that server side validation is more
important, from e.g. security reasons, but if you make something we
called now Web 2.0 application is nice to have also client side
validations scripts. So I can check if login is free to use via Ajax,
but checking if password confirmation match password I would prefer to
do via normal JavaScript code (if there are huge number of requests,
it'll be better solution). Such functionality offered Struts, so if
there is no such functionality in Wicket it would be probably my first
step to write one.

Thanks again for answers,
Adr

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


Re: Question about JavaScript validation

Posted by Johan Compagner <jc...@gmail.com>.
I agree that is is nice to have the simple field validation done in
javascript on the client side. But this is an add on, the same
validation has still to be done on the server anyway.

But in the further we could have some validations that also contribute
some javascript to  the output which does the validation first on the
server

2007/11/24, Timo Rantalaiho <Ti...@ri.fi>:
> On Fri, 23 Nov 2007, Java Programmer wrote:
> > Is there any simple way to generate javascripts to validate forms
> > against validation rules provided by Wicket Validators e.g.
> > RequiredValidator? I have on mind client side validators to check is
> > fields not empty, or provided passwords match. For now I see that Ajax
> > support is great, but cant find any exaples for common client
> > javascripts to prevalidate forms - if there are any ready to use, how
> > can I write my own? Any working examples to see?
>
> In a more general note, I have noticed that for internal
> applications for low numbers of users it does make more
> sense to just do all validation on the server side, because
> you easily run into things that cannot be feasibly validated
> on client side, and nowadays with Ajax it's possible to
> provide good feedback to the client as well. And it's simple
> when everything is validated the same way.
>
> For public applications for more users, client-side pre-
> validation might make sense to cut load from the server and
> to generate feedback to the user more rapidly than you could
> with server roundtrips over the Internet. Even there it
> might be interesting if you could prevalidate something with
> Javascript and if that passes, do the server-side checks
> with Ajax, making everything transparent to the user.
>
> For example the syntax of an email address could be
> checked with Javascript, and whether the email address
> is already registered using ajax. (For internal applications
> it's better to use EmailAddressValidator with Ajax and add
> the custom check as another validator.)
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> 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


Re: Question about JavaScript validation

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Fri, 23 Nov 2007, Java Programmer wrote:
> Is there any simple way to generate javascripts to validate forms
> against validation rules provided by Wicket Validators e.g.
> RequiredValidator? I have on mind client side validators to check is
> fields not empty, or provided passwords match. For now I see that Ajax
> support is great, but cant find any exaples for common client
> javascripts to prevalidate forms - if there are any ready to use, how
> can I write my own? Any working examples to see?

In a more general note, I have noticed that for internal
applications for low numbers of users it does make more
sense to just do all validation on the server side, because
you easily run into things that cannot be feasibly validated
on client side, and nowadays with Ajax it's possible to
provide good feedback to the client as well. And it's simple
when everything is validated the same way.

For public applications for more users, client-side pre-
validation might make sense to cut load from the server and
to generate feedback to the user more rapidly than you could
with server roundtrips over the Internet. Even there it
might be interesting if you could prevalidate something with
Javascript and if that passes, do the server-side checks
with Ajax, making everything transparent to the user.

For example the syntax of an email address could be
checked with Javascript, and whether the email address
is already registered using ajax. (For internal applications
it's better to use EmailAddressValidator with Ajax and add
the custom check as another validator.)

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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