Correction: DynaValidatorForm.validate() does not seemt o validate Integers when called from DispatchAction [Re: Problem validating form manually in DispatchAction]

2003-10-10 Thread Elie Medeiros
In reference to the problem below, it actually seems that the
DynaValidatorForm.validate() method does validate Strings, but not
Integers

any clues appreciated

Elie

> Hi there,
> 
> am having a problem validating a form manually using the
> DynaValidatorForm.validate() function. For some reason, when validation
> is carried out this way it only seems to find errors in one of the form
> fields - however, if I set the validate="true" property in the
> struts-module-config.xml file, validation does seem to be carried out
> properly, which suggests to me that I did not make a mistake in the
> validation configuration. Since I want to use DispatchAction however, I
> can't use validate="true", as I need to validate the form selectively
> for one of the methods only. 
> 
> I have tried using ValidatorLookupdispatchForm, but can't use it as
> Struts 1.1 (which I am using) seems to have a bug with the set-property
> tag in the module-config.xml file. Also tried latest version of Struts
> (1.1, was using 1.1rc3) and of the validator (1.0, 1.02, latest nightly
> build). My code is as follows - pretty straightforward:
> 
> 
>   DynaValidatorForm thisForm = (DynaValidatorForm)form;
>   ActionErrors errors=thisForm.validate(mapping,request);
>   
> Integer var1= (Integer)thisForm.get("var1");
> (... get more form vars...)
>   
>   //if errors, back to form
>   if (!errors.isEmpty()) {
>   saveErrors(request, errors);
> 
>   return mapping.getInputForward();
>}
> 
> 
> 
>  path="/details" 
>   scope="request"
>   parameter="method"
>   type="com.inc.modules.users.DetailsAction"
>   validate="false">
>   
>  
>   
> 
> 
> 
>   
>  property="var1"
>   depends="required,integer">
>   
>   
>   
>   
>   
>   
> 
> 
> I have spent almost 2 days trying to figure ways of getting around this
> - anyone have any ideas?
> 
> Thanks,
> Elie
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem validating form manually in DispatchAction

2003-10-10 Thread Elie Medeiros
Hi there,

am having a problem validating a form manually using the
DynaValidatorForm.validate() function. For some reason, when validation
is carried out this way it only seems to find errors in one of the form
fields - however, if I set the validate="true" property in the
struts-module-config.xml file, validation does seem to be carried out
properly, which suggests to me that I did not make a mistake in the
validation configuration. Since I want to use DispatchAction however, I
can't use validate="true", as I need to validate the form selectively
for one of the methods only. 

I have tried using ValidatorLookupdispatchForm, but can't use it as
Struts 1.1 (which I am using) seems to have a bug with the set-property
tag in the module-config.xml file. Also tried latest version of Struts
(1.1, was using 1.1rc3) and of the validator (1.0, 1.02, latest nightly
build). My code is as follows - pretty straightforward:


DynaValidatorForm thisForm = (DynaValidatorForm)form;
ActionErrors errors=thisForm.validate(mapping,request);

Integer var1= (Integer)thisForm.get("var1");
(... get more form vars...)

//if errors, back to form
if (!errors.isEmpty()) {
saveErrors(request, errors);

return mapping.getInputForward();
 }





   














I have spent almost 2 days trying to figure ways of getting around this
- anyone have any ideas?

Thanks,
Elie


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]