You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by James Carlyle <ja...@takepart.com> on 2005/02/17 14:30:32 UTC

ValidatorTool: getDynamicJavascript does not produce output

Hi

I am using the Velocity ValidatorTool to do client side javascript
validation for my Struts application.

I have placed calls to $validator.getStaticJavascript() and
getDynamicJavascript() in my .vm template.  For example

$validator.getDynamicJavascript("${formName}")

The static call works (produces a <script> block) but the dynamic one
doesn't produce anything.

I am using these jars:

velocity-tools-1.1.jar (contains ValidatorTool.class, dated 17 May 2004)
velocity-1.4.jar
velocity-dep-1.3.1.jar

Many thanks if you can help

James

p.s. content generated by static call is this:

<script type="text/javascript" language="Javascript1.1"> 

<!-- Begin 



   /*$RCSfile: validateFloatRange.js,v $ $Revision: 1.9 $ $Date: 2004/03/28 16:53:21 $ */
    /**
    * Check to see if fields are in a valid float range.
    * Fields are not checked if they are disabled.
    * <p>
    * @param form The form validation is taking place on.
    */
    function validateFloatRange(form) {

---- massive snipping ------

        if (fields.length > 0) {
           focusField.focus();
           alert(fields.join('\n'));
        }
        return isValid;
    }


//End --> 
</script>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by "Marino A. Jonsson" <ma...@hotmail.com>.
I am actively and successfully using Struts 1.2.x with VelocityTools 1.2dev
and Velocity 1.4.

Admittedly I haven't been using the ValidatorTool (only use server side
validation) but I still took some time to upgrade it so it should work fine
for Struts 1.2.x now (the app5 velstruts example has been upgraded to
showcase the latest version).

cheers,
Marin�

"Nathan Bubna" <nb...@gmail.com> wrote in message 
news:4d651da50502170752388a1976@mail.gmail.com...
> On Thu, 17 Feb 2005 17:30:02 +0200, Florin Vancea <fv...@maxiq.ro> 
> wrote:
>> AFAIR, it was the _only_ way to get things working :)
>>
>> I did some minor modifications to the -tools source while going my way. 
>> As
>> soon as I get to breathe (as I'm really swamped now), I'll check if they 
>> are
>> worth anything for the community and if so, I'll make sure to post back.
>
> if you could find the time, that'd be great.  i'm fairly swamped
> myself, but i'm slowly trying to bring things around for release of
> VelocityTools 1.2.  Right now my biggest concern is the
> up-to-date-ness of the VelocityStruts tools, because i haven't been
> able to use them actively myself.  so *any* help, however small, in
> preparing and double-checking that those are up to speed with Struts
> 1.2.4 would be greatly appreciated!
>
>> Must say that using Velocity instead JSP for rendering is _so_cool_ that 
>> I
>> would never go back. Thanks!
>
> :)
>
>> Florin
>>
>> ----- Original Message -----
>> From: "Shinobu Kawai" <sh...@gmail.com>
>> To: "Velocity Users List" <ve...@jakarta.apache.org>
>> Sent: Thursday, February 17, 2005 4:57 PM
>> Subject: Re: ValidatorTool: getDynamicJavascript does not produce output
>>
>> > Hi Florin,
>> >
>> > > You also may want to check if your Struts is 1.2.x. If so, you'd be
>> better
>> > > off using the (afaik not released yet) velocity-tools-1.2. Get the
>> latest
>> > > sources, compile and use. It's really stable (at least that's what I
>> > > currently use).
>> >
>> > Thanks for the report.  Nice to hear word from the street that
>> > tools-1.2 is doing fine.  I've aways wondered how good it was with the
>> > new Struts.
>> >
>> > Best regards,
>> > -- Shinobu
>> >
>> > --
>> > Shinobu Kawai <sh...@gmail.com>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>> 




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by "Marino A. Jonsson" <ma...@hotmail.com>.
I am actively and successfully using Struts 1.2.x with VelocityTools 1.2dev
and Velocity 1.4.

Admittedly I haven't been using the ValidatorTool (only use server side
validation) but I still took some time to upgrade it so it should work fine
for Struts 1.2.x now (the app5 velstruts example has been upgraded to
showcase the latest version).

cheers,
Marin�

"Nathan Bubna" <nb...@gmail.com> wrote in message 
news:4d651da50502170752388a1976@mail.gmail.com...
> On Thu, 17 Feb 2005 17:30:02 +0200, Florin Vancea <fv...@maxiq.ro> 
> wrote:
>> AFAIR, it was the _only_ way to get things working :)
>>
>> I did some minor modifications to the -tools source while going my way. 
>> As
>> soon as I get to breathe (as I'm really swamped now), I'll check if they 
>> are
>> worth anything for the community and if so, I'll make sure to post back.
>
> if you could find the time, that'd be great.  i'm fairly swamped
> myself, but i'm slowly trying to bring things around for release of
> VelocityTools 1.2.  Right now my biggest concern is the
> up-to-date-ness of the VelocityStruts tools, because i haven't been
> able to use them actively myself.  so *any* help, however small, in
> preparing and double-checking that those are up to speed with Struts
> 1.2.4 would be greatly appreciated!
>
>> Must say that using Velocity instead JSP for rendering is _so_cool_ that 
>> I
>> would never go back. Thanks!
>
> :)
>
>> Florin
>>
>> ----- Original Message -----
>> From: "Shinobu Kawai" <sh...@gmail.com>
>> To: "Velocity Users List" <ve...@jakarta.apache.org>
>> Sent: Thursday, February 17, 2005 4:57 PM
>> Subject: Re: ValidatorTool: getDynamicJavascript does not produce output
>>
>> > Hi Florin,
>> >
>> > > You also may want to check if your Struts is 1.2.x. If so, you'd be
>> better
>> > > off using the (afaik not released yet) velocity-tools-1.2. Get the
>> latest
>> > > sources, compile and use. It's really stable (at least that's what I
>> > > currently use).
>> >
>> > Thanks for the report.  Nice to hear word from the street that
>> > tools-1.2 is doing fine.  I've aways wondered how good it was with the
>> > new Struts.
>> >
>> > Best regards,
>> > -- Shinobu
>> >
>> > --
>> > Shinobu Kawai <sh...@gmail.com>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>> 




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by Nathan Bubna <nb...@gmail.com>.
On Thu, 17 Feb 2005 17:30:02 +0200, Florin Vancea <fv...@maxiq.ro> wrote:
> AFAIR, it was the _only_ way to get things working :)
> 
> I did some minor modifications to the -tools source while going my way. As
> soon as I get to breathe (as I'm really swamped now), I'll check if they are
> worth anything for the community and if so, I'll make sure to post back.

if you could find the time, that'd be great.  i'm fairly swamped
myself, but i'm slowly trying to bring things around for release of
VelocityTools 1.2.  Right now my biggest concern is the
up-to-date-ness of the VelocityStruts tools, because i haven't been
able to use them actively myself.  so *any* help, however small, in
preparing and double-checking that those are up to speed with Struts
1.2.4 would be greatly appreciated!

> Must say that using Velocity instead JSP for rendering is _so_cool_ that I
> would never go back. Thanks!

:)

> Florin
> 
> ----- Original Message -----
> From: "Shinobu Kawai" <sh...@gmail.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Thursday, February 17, 2005 4:57 PM
> Subject: Re: ValidatorTool: getDynamicJavascript does not produce output
> 
> > Hi Florin,
> >
> > > You also may want to check if your Struts is 1.2.x. If so, you'd be
> better
> > > off using the (afaik not released yet) velocity-tools-1.2. Get the
> latest
> > > sources, compile and use. It's really stable (at least that's what I
> > > currently use).
> >
> > Thanks for the report.  Nice to hear word from the street that
> > tools-1.2 is doing fine.  I've aways wondered how good it was with the
> > new Struts.
> >
> > Best regards,
> > -- Shinobu
> >
> > --
> > Shinobu Kawai <sh...@gmail.com>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by Florin Vancea <fv...@maxiq.ro>.
AFAIR, it was the _only_ way to get things working :)

I did some minor modifications to the -tools source while going my way. As
soon as I get to breathe (as I'm really swamped now), I'll check if they are
worth anything for the community and if so, I'll make sure to post back.

Must say that using Velocity instead JSP for rendering is _so_cool_ that I
would never go back. Thanks!

Florin

----- Original Message ----- 
From: "Shinobu Kawai" <sh...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, February 17, 2005 4:57 PM
Subject: Re: ValidatorTool: getDynamicJavascript does not produce output


> Hi Florin,
>
> > You also may want to check if your Struts is 1.2.x. If so, you'd be
better
> > off using the (afaik not released yet) velocity-tools-1.2. Get the
latest
> > sources, compile and use. It's really stable (at least that's what I
> > currently use).
>
> Thanks for the report.  Nice to hear word from the street that
> tools-1.2 is doing fine.  I've aways wondered how good it was with the
> new Struts.
>
> Best regards,
> -- Shinobu
>
> --
> Shinobu Kawai <sh...@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Florin,

> You also may want to check if your Struts is 1.2.x. If so, you'd be better
> off using the (afaik not released yet) velocity-tools-1.2. Get the latest
> sources, compile and use. It's really stable (at least that's what I
> currently use).

Thanks for the report.  Nice to hear word from the street that
tools-1.2 is doing fine.  I've aways wondered how good it was with the
new Struts.

Best regards,
-- Shinobu

--
Shinobu Kawai <sh...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by James Carlyle <ja...@takepart.com>.
Florin

Thanks for your prompt suggestions.

1.
    <form-bean name="userWizardForm" 
type="org.apache.struts.validator.DynaValidatorActionForm">
        <form-property name="userId" type="java.lang.Integer"/>

I've noticed that I am using DynaValidatorActionForm - might that make a 
difference?

2.
<action path="/user/wizard/core"
    type="com.sky.skynet.web.ModeAction"
    name="userWizardForm"         scope="session" validate="false">
    <forward name="insert"                        path=".user.insert.form"/>
    <forward name="update"                        path=".user.update.form"/>
</action>
<action path="/user/wizard/summary"
    type="com.sky.skynet.web.ModeAction"
    name="userWizardForm"        scope="session"    validate="true"    
input="/do/user/wizard/core">
    <forward name="insert"                         
path=".user.insert.summary"/>
    <forward name="update"                         
path=".user.update.summary"/>
</action>

<form name="/user/wizard/summary">
    <field property="loginName" depends="required">
        <msg name="required" key="errorsRequired"/>
        <arg0 key="loginName"/>
    </field>
....etc

3. Think so :) see 4.

4. Yes, validation works as expected server side

I am using Struts 1.2.4.  I will download the velocity-tools-1.2 package 
and compile and see what happens.

James


Florin Vancea wrote:

>1. Do you have an ActionForm for the action that ends up being rendered by
>Velocity?
>2. Does this form have a section in the Struts validation definition files?
>3. Is validation setup OK (i.e. in Struts files)?
>4. Does validation work server-side?
>
>AFAIR, no. 2 is most likely the culprit.
>
>You also may want to check if your Struts is 1.2.x. If so, you'd be better
>off using the (afaik not released yet) velocity-tools-1.2. Get the latest
>sources, compile and use. It's really stable (at least that's what I
>currently use).
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ValidatorTool: getDynamicJavascript does not produce output

Posted by Florin Vancea <fv...@maxiq.ro>.
1. Do you have an ActionForm for the action that ends up being rendered by
Velocity?
2. Does this form have a section in the Struts validation definition files?
3. Is validation setup OK (i.e. in Struts files)?
4. Does validation work server-side?

AFAIR, no. 2 is most likely the culprit.

You also may want to check if your Struts is 1.2.x. If so, you'd be better
off using the (afaik not released yet) velocity-tools-1.2. Get the latest
sources, compile and use. It's really stable (at least that's what I
currently use).

----- Original Message ----- 
From: "James Carlyle" <ja...@takepart.com>
To: <ve...@jakarta.apache.org>
Sent: Thursday, February 17, 2005 3:30 PM
Subject: ValidatorTool: getDynamicJavascript does not produce output


> Hi
>
> I am using the Velocity ValidatorTool to do client side javascript
> validation for my Struts application.
>
> I have placed calls to $validator.getStaticJavascript() and
> getDynamicJavascript() in my .vm template.  For example
>
> $validator.getDynamicJavascript("${formName}")
>
> The static call works (produces a <script> block) but the dynamic one
> doesn't produce anything.
>
> I am using these jars:
>
> velocity-tools-1.1.jar (contains ValidatorTool.class, dated 17 May 2004)
> velocity-1.4.jar
> velocity-dep-1.3.1.jar
>
> Many thanks if you can help
>
> James
>
> p.s. content generated by static call is this:
>
> <script type="text/javascript" language="Javascript1.1">
>
> <!-- Begin
>
>
>
>    /*$RCSfile: validateFloatRange.js,v $ $Revision: 1.9 $ $Date:
2004/03/28 16:53:21 $ */
>     /**
>     * Check to see if fields are in a valid float range.
>     * Fields are not checked if they are disabled.
>     * <p>
>     * @param form The form validation is taking place on.
>     */
>     function validateFloatRange(form) {
>
> ---- massive snipping ------
>
>         if (fields.length > 0) {
>            focusField.focus();
>            alert(fields.join('\n'));
>         }
>         return isValid;
>     }
>
>
> //End -->
> </script>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org