You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jean-Marie Pitre <jm...@cofisun.com> on 2006/08/31 17:15:18 UTC
validateValidWhen and javascript
Hi,
Is there a javascript file to use validateValidWhen method on client
side ?
Thanks,
Regards,
Jean-Marie
-------------------
Email Disclaimer
http://www.cofidis.be/emaildisclaimer.php
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validateValidWhen and javascript
Posted by Laurie Harper <la...@holoweb.net>.
Wendy Smoak wrote:
> On 8/31/06, John R. Dumonceaux <Jo...@supervalu.com> wrote:
>
>> Is there a way to include only the J/S actually used?
>>
>> I'm doing client side validation with j/s and ended up writting my own
>> routines - thus the validation does seem to add much.
>
> Where are you putting your JavaScript? There might be a hint at the
> top of validator-rules.xml:
>
> Note: Starting in Struts 1.2.0 the default javascript definitions have
> been consolidated to commons-validator. The default can be
> overridden
> by supplying a <javascript> element with a CDATA section, just as
> in struts 1.1.
>
> From that, I think you can supply your own validator-rules.xml with
> custom JavaScript in CDATA sections, and then remove the 'jsFunction'
> attribute for the validations you don't want.
>
> Just a thought, I haven't tried it.
You can also set (IIRC) static=false on the html:javascript tag to tell
it not to generate the non-dynamic stuff, then include that as an
external script, to minimize the amount of Javascript that's generated
in-line.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validateValidWhen and javascript
Posted by Wendy Smoak <ws...@gmail.com>.
On 8/31/06, John R. Dumonceaux <Jo...@supervalu.com> wrote:
> Is there a way to include only the J/S actually used?
>
> I'm doing client side validation with j/s and ended up writting my own
> routines - thus the validation does seem to add much.
Where are you putting your JavaScript? There might be a hint at the
top of validator-rules.xml:
Note: Starting in Struts 1.2.0 the default javascript definitions have
been consolidated to commons-validator. The default can be overridden
by supplying a <javascript> element with a CDATA section, just as
in struts 1.1.
>From that, I think you can supply your own validator-rules.xml with
custom JavaScript in CDATA sections, and then remove the 'jsFunction'
attribute for the validations you don't want.
Just a thought, I haven't tried it.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validateValidWhen and javascript
Posted by "John R. Dumonceaux" <Jo...@supervalu.com>.
"ALL the validation J/S"
Is there a way to include only the J/S actually used?
I'm doing client side validation with j/s and ended up writting my own
routines - thus the validation does seem to add much.
John Dumonceaux
Adam Gordon <ad...@readytalk.com>
08/31/2006 10:39 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
Re: validateValidWhen and javascript
J-
IIRC, the J/S that is inserted is ALL the validation J/S whether you use
it or not. I.e., even if you aren't using, say 'maxlength,' I belive
that method is included. That said, we don't use client-side validation
because you really should do server-side anyway and we didn't like the
way the errors were displayed on client-side (all the errors in a J/S
alert box). Clearly, we could have changed this, but we went with
server-side only...
-adam
Jean-Marie Pitre wrote:
> Hi,
>
> Is there a javascript file to use validateValidWhen method on client
> side ?
>
> Thanks,
>
> Regards,
>
> Jean-Marie
>
> -------------------
> Email Disclaimer
> http://www.cofidis.be/emaildisclaimer.php
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validateValidWhen and javascript
Posted by Adam Gordon <ad...@readytalk.com>.
J-
IIRC, the J/S that is inserted is ALL the validation J/S whether you use
it or not. I.e., even if you aren't using, say 'maxlength,' I belive
that method is included. That said, we don't use client-side validation
because you really should do server-side anyway and we didn't like the
way the errors were displayed on client-side (all the errors in a J/S
alert box). Clearly, we could have changed this, but we went with
server-side only...
-adam
Jean-Marie Pitre wrote:
> Hi,
>
> Is there a javascript file to use validateValidWhen method on client
> side ?
>
> Thanks,
>
> Regards,
>
> Jean-Marie
>
> -------------------
> Email Disclaimer
> http://www.cofidis.be/emaildisclaimer.php
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validateValidWhen and javascript
Posted by Wendy Smoak <ws...@gmail.com>.
On 8/31/06, Jean-Marie Pitre <jm...@cofisun.com> wrote:
> Is there a javascript file to use validateValidWhen method on client
> side ?
No. If you look in the bundled validation-rules.xml file for 1.3,
there is no 'jsFunction' attribute for validwhen. (The JavaScript for
the default rules now lives in Commons Validator.)
http://svn.apache.org/repos/asf/struts/struts1/trunk/core/src/main/resources/org/apache/struts/validator/validator-rules.xml
The Java code for validwhen is generated by Antlr. You can look at
the source, here:
http://svn.apache.org/repos/asf/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org