ValidatorTool: getDynamicJavascript does not produce output

2005-02-17 Thread James Carlyle
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ValidatorTool: getDynamicJavascript does not produce output

2005-02-17 Thread James Carlyle
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=insertpath=.user.insert.form/
   forward name=updatepath=.user.update.form/
/action
action path=/user/wizard/summary
   type=com.sky.skynet.web.ModeAction
   name=userWizardFormscope=sessionvalidate=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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]