Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Validate a textField using Struts Validator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Validate a textField using Struts Validator" Watch "Validate a textField using Struts Validator" New topic

Validate a textField using Struts Validator

Yuvika Sharma

Joined: Aug 06, 2004
Posts: 2
I am having problem validating a text field if another text-box is filled.
I ws trying to use requiredif or validwhen methods from validator-rules but it doesnt work. Could someone suggest what I'm doing wrong.
This is the validwhen in Validator-rules.xml
<validator name="validwhen"


This is my Valiadtions.xml entry:

<arg0 key="SupplierContactsForm.conName2"/>
<var-value>((location2== null) or (*this* != null))</var-value>

ConName2 and location2 are the two textboxes I ahve on my jsp page.
I have all other things in place, the required validations is working on the same page.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60748

"Yuvi Yuvi",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

P.S. Also we have a forum for Struts questions... I'll move this topic there for you.
[ August 06, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Validate a textField using Struts Validator
Similar Threads
Validate a textField using Struts Validator
Validwhen validator question
struts 1.2.7 validation using validwhen
Problems with checkbox using Struts Validation
validwhen not work, even validate double not work