Validwhen confusion?
Hey everybody, Just want to validate a two field match using validwhen: field property=newPass1 depends=required,validwhen arg0 key=prompt.newPass/ var var-namesomething/var-name var-value(*this* == newPass2)/var-value /var /field No matter what I put in the var-value space it always returns true! The required statement works well. Do I miss a library? Regards, Nils
Validwhen confusion?
Hey everybody, Just want to validate a two field match using validwhen: field property=newPass1 depends=required,validwhen arg0 key=prompt.newPass/ var var-namesomething/var-name var-value(*this* == newPass2)/var-value /var /field No matter what I put in the var-value space it always returns true! The required statement works well. Do I miss a library? Regards, Nils
RE: Validwhen confusion? Using Struts 1.2.4
I am using Struts 1.2.4 -Original Message- From: Nils Liebelt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 6:41 PM To: 'Struts Users Mailing List' Subject: Validwhen confusion? Hey everybody, Just want to validate a two field match using validwhen: field property=newPass1 depends=required,validwhen arg0 key=prompt.newPass/ var var-namesomething/var-name var-value(*this* == newPass2)/var-value /var /field No matter what I put in the var-value space it always returns true! The required statement works well. Do I miss a library? Regards, Nils - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validwhen confusion? Using Struts 1.2.4
I am using Struts 1.2.4 -Original Message- From: Nils Liebelt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 6:41 PM To: 'Struts Users Mailing List' Subject: Validwhen confusion? Hey everybody, Just want to validate a two field match using validwhen: field property=newPass1 depends=required,validwhen arg0 key=prompt.newPass/ var var-namesomething/var-name var-value(*this* == newPass2)/var-value /var /field No matter what I put in the var-value space it always returns true! The required statement works well. Do I miss a library? Regards, Nils - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validwhen confusion
Hi All, I am having trouble getting my mind around the boolean expression semantics of the validwhen validator. Consider the following example. I have a form with two possible input groups depending on the user selection. If the entity is an individual, then I need to require firstName etc. If the entity is a business then I need to require a business name. Below is my validation code. field property=firstName depends=validwhen, mask arg0 key=prompt.common.firstName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=lastName depends=validwhen, mask arg0 key=prompt.common.lastName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=ssn depends=validwhen, mask arg0 key=prompt.common.ssn / arg1 key=prompt.common.ssn.format / var var-namemask/var-name var-value${ssn}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=birthDate depends=validwhen, date arg0 key=prompt.common.birthDate / var var-namedatePatternStrict/var-name var-value${date}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=businessName depends=validwhen, mask arg0 key=prompt.common.businessName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == business)/var-value /var /field However when business is the entityType, firstName, lastName, ssn, and birthDate show up as required in the error messages. When the entityType is individual businessName shows up. I thought that the value was reversed in the jsp, hence reversing it when it is being set into the form. I debugged the validate method and the enityType is being set correctly. This operand seems sufficient to work correctly. However changing all of the == to != seems counterintuitive to me. It seems to me that my logic should work. {firstName} is required when {entityType} == individual. Can someone explain the semantics of the need to negate all of the expressions? Thanks, Todd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validwhen confusion
On Sat, 15 Jan 2005 15:08:17 -0500, Todd Nine [EMAIL PROTECTED] wrote: Hi All, I am having trouble getting my mind around the boolean expression semantics of the validwhen validator. Consider the following example. I have a form with two possible input groups depending on the user selection. If the entity is an individual, then I need to require firstName etc. If the entity is a business then I need to require a business name. Below is my validation code. field property=firstName depends=validwhen, mask arg0 key=prompt.common.firstName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name If the test evaluates to false then it results in an ActionError. (JavaDocs : Checks if the field matches the boolean expression specified in test parameter.) var-value(entityType == individual)/var-value This says that if entityType is individual then this property (firstName) satisfies this condition no matter what the value of firstName is. On the otherhand if entityType == business then this condition evaluates to false and so this property (firstName) is tagged as required by the validator. (You should get this message even if you specify something for firstName) /var /field field property=lastName depends=validwhen, mask arg0 key=prompt.common.lastName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=ssn depends=validwhen, mask arg0 key=prompt.common.ssn / arg1 key=prompt.common.ssn.format / var var-namemask/var-name var-value${ssn}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=birthDate depends=validwhen, date arg0 key=prompt.common.birthDate / var var-namedatePatternStrict/var-name var-value${date}/var-value /var var var-nametest/var-name var-value(entityType == individual)/var-value /var /field field property=businessName depends=validwhen, mask arg0 key=prompt.common.businessName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == business)/var-value /var /field However when business is the entityType, firstName, lastName, ssn, and birthDate show up as required in the error messages. When the entityType is individual businessName shows up. I thought that the value was reversed in the jsp, hence reversing it when it is being set into the form. I debugged the validate method and the enityType is being set correctly. This operand seems sufficient to work correctly. However changing all of the == to != seems counterintuitive to me. Even if specify something like this, field property=firstName depends=validwhen, mask arg0 key=prompt.common.firstName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType != individual)/var-value /var /field it doesn't work as you expect it to, as you can see it fails when entityType is individual. So, the right way of specifying the conditionals is to think about when you don't need that property. For example another of saying firstName is required when entityType = individual is firstName is required unless entityType = business so now you conditional would be field property=firstName depends=validwhen, mask arg0 key=prompt.common.firstName / var var-namemask/var-name var-value${alphaname}/var-value /var var var-nametest/var-name var-value(entityType == business) or (*this*!=null)/var-value /var /field Which says if entityType=business firstName is not required otherwise (entityType !=business implicity entityType=individual) this(firstName) is required It seems to me that my logic should work. {firstName} is required when {entityType} == individual. Can someone explain the semantics of the need to negate all of the expressions? Thanks, Todd - 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]