You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by djkuul <dh...@hotmail.com> on 2008/04/07 06:26:29 UTC

What should happen- @ValidateRequired(enabled=false) ??

I am using the following annotation for validation on an Action method-

validatableProperties={ 
@Jpf.ValidatableProperty( 
displayName = "User Name ",
propertyName = "username",
validateRequired= @ValidateRequired(enabled=false))
}

If enabled is set to false, then the validate required rule should not be
applied but in this case the validate required rule IS Applied... WHY??

I want to do conditional validation, and hence am using the enabled = false.
Going ahead I want to substitute the value of enabled with a runtime
expression depending upon whether the validation has to be done or
not(decided on the jsp). Any ideas?

Appreciate any help, Thanks!
-- 
View this message in context: http://www.nabble.com/What-should-happen--%40ValidateRequired%28enabled%3Dfalse%29----tp16533317p16533317.html
Sent from the Beehive - Dev mailing list archive at Nabble.com.


RE: What should happen- @ValidateRequired(enabled=false) ??

Posted by Steven Dalton <sj...@trammel.com.au>.
Suspect this belongs on this list not dev to replied here instead.


This is an example of a Controller action annotation I use which sets the
validation on/off differently IE doValidation=true/false

@Jpf.Action(
 forwards = {
		@Jpf.Forward(name = "success", path = signUpInitiated.jsp")
        	},
        validationErrorForward = @Jpf.Forward(name = "fail", 
	                         navigateTo = Jpf.NavigateTo.currentPage),
        useFormBean="userForm",doValidation=true
)				

Hope this of some help.

Steven Dalton


-----Original Message-----
From: djkuul [mailto:dhwajad@hotmail.com] 
Sent: Tuesday, April 22, 2008 4:58 AM
To: dev@beehive.apache.org
Subject: Re: What should happen- @ValidateRequired(enabled=false) ??


The exact situation is as follows-
1. The jsp has two user actions-
        i Continue with validations
        ii Continue without validations
        Both the above Continue user actions map to the same action method.
2. The action method is decorated with appropriate validation annotations.
3. Now the problem is to apply the validation annotations on one user action
and not apply them on another user action. We can have a boolean in the form
bean to be set from the jsp to decide if the validations have to be applied
or not.

There are other simple solutions for this problem but I thought the obvious
one using beehive was the one I have mentioned in my first post....

Has anybody encountered this situation before? Has anybody used the enabled
property of the Jpf validation annotations?



djkuul wrote:
> 
> I am using the following annotation for validation on an Action method-
> 
> validatableProperties={ 
> @Jpf.ValidatableProperty( 
> displayName = "User Name ",
> propertyName = "username",
> validateRequired= @ValidateRequired(enabled=false))
> }
> 
> If enabled is set to false, then the validate required rule should not be
> applied but in this case the validate required rule IS Applied... WHY??
> 
> I want to do conditional validation, and hence am using the enabled =
> false. Going ahead I want to substitute the value of enabled with a
> runtime expression depending upon whether the validation has to be done or
> not(decided on the jsp). Any ideas?
> 
> Appreciate any help, Thanks!
> 

-- 
View this message in context:
http://www.nabble.com/What-should-happen--%40ValidateRequired%28enabled%3Dfa
lse%29----tp16533317p16809863.html
Sent from the Beehive - Dev mailing list archive at Nabble.com.

Internal Virus Database is out-of-date.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1301 - Release Date: 2/27/2008
8:35 AM
 

Internal Virus Database is out-of-date.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1301 - Release Date: 2/27/2008
8:35 AM
 


Re: What should happen- @ValidateRequired(enabled=false) ??

Posted by djkuul <dh...@hotmail.com>.
The exact situation is as follows-
1. The jsp has two user actions-
        i Continue with validations
        ii Continue without validations
        Both the above Continue user actions map to the same action method.
2. The action method is decorated with appropriate validation annotations.
3. Now the problem is to apply the validation annotations on one user action
and not apply them on another user action. We can have a boolean in the form
bean to be set from the jsp to decide if the validations have to be applied
or not.

There are other simple solutions for this problem but I thought the obvious
one using beehive was the one I have mentioned in my first post....

Has anybody encountered this situation before? Has anybody used the enabled
property of the Jpf validation annotations?



djkuul wrote:
> 
> I am using the following annotation for validation on an Action method-
> 
> validatableProperties={ 
> @Jpf.ValidatableProperty( 
> displayName = "User Name ",
> propertyName = "username",
> validateRequired= @ValidateRequired(enabled=false))
> }
> 
> If enabled is set to false, then the validate required rule should not be
> applied but in this case the validate required rule IS Applied... WHY??
> 
> I want to do conditional validation, and hence am using the enabled =
> false. Going ahead I want to substitute the value of enabled with a
> runtime expression depending upon whether the validation has to be done or
> not(decided on the jsp). Any ideas?
> 
> Appreciate any help, Thanks!
> 

-- 
View this message in context: http://www.nabble.com/What-should-happen--%40ValidateRequired%28enabled%3Dfalse%29----tp16533317p16809863.html
Sent from the Beehive - Dev mailing list archive at Nabble.com.