I wish the solution was that easy - I tried your expression below and still
no dice. Maybe it's something so small I can't see it? Does it have
something to do with the fact that "reason" is a radio button that sets a
String value?

Matt


Eric Rank-2 wrote:
> 
> Hi Matt,
> 
> I tried out your scenario, and I think I found the problem. In my  
> test, it also validated when I left the friendEmail field blank. It  
> seems that the value of friendEmail is not null, but an empty string.  
> To solve the problem, I added another clause to check for String  
> length. After that, it triggered the field error as desired. This is  
> what worked for me.
> 
> <validators>
>    <field name="friendEmail">
>          <field-validator type="fieldexpression">
>              reason == 'friend' and  
> friendEmail != null and friendEmail.trim().size() > 0
>              <message>Please provide your friend's email</message>
>          </field-validator>
>      </field>
> </validators>
> 
> 
> Eric.
> 
> 
> On Jul 19, 2007, at 10:40 AM, mraible wrote:
> 
>> If you're right, I'd expect the following expression make friendEmail
>> required when the "friend" reason is checked (it's a radio button):
>>
>> reason == 'friend' and friendEmail != null
>>
>> However, if I check friend and don't fill out the e-mail address,  
>> it still
>> passes validation. Based on the error message I'm getting in my  
>> logs (see
>> below), I'm guessing that I need to do some sort of "friendEmail !=  
>> null"
>> check, but I'm already doing that.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11699294
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to