Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problem with validwhen in validation.xml

  Asked By: Willie    Date: Aug 28    Category: Java    Views: 1855

I have a problem with validation.xml in struts. I validation.xml in my
app to check validity of a form. Every thing is ok except "validwhen"
that it doesnt work.
There is a form in App with two textbox, each of them depends on
another one. It mean both of them should have a value or shouldn't. To
handle this situation I used "validWhen" in validation.xml but it seems
validator rules completely ignored this part of validation.
I use xdoclet1.2.2 to generate validation.xml, with tomcat5
So, how could I solve this problem!



5 Answers Found

Answer #1    Answered By: Brent Brown     Answered On: Aug 28

i think that u should check  u'r struts.config.xml and
set the validation  tag to true...
if u used from a action and form  bean... u should do
same this for validation:
<action path="/edit" type="action.EditAction"
name="EditForm" validate="true">

Answer #2    Answered By: Kay Rodriguez     Answered On: Aug 28

but my problem  is only for validwhen, other validation  instructions
work right, and I had set validate="true" in strutsconfig file,
I myself think maybe somthing in commons-validator.jar is wrong or
something like this.

Answer #3    Answered By: Paul Brooks     Answered On: Aug 28

When you can use struts  valdation that type of your form  bean be "DynaValidatorForm".

Answer #4    Answered By: Sheryl Morgan     Answered On: Aug 28

I think DynaValidatorForm correspond to DynaActionForm, but my
formbean is a kind of ActionForm, so I have used validatorForm. when
my validation  instructions are simple , for
example "required", "minlenghth" and "maxlength", "integer" and so
on, validation works fine. But when I want to define some validation
rules that they are complex a bit (for example comparing two fields
with each other by using "validWhen") it doesnt work  fine and it
ignores this complex rules  (I should emphesize it only ignores this
kind of validation rules, simple validation rules work fine yet).
The type of form  bean is validatorForm and in strutsconfig.xml I set
validation="true" and I set the plugin for validation-rules in
strutsconfig, but the problem  exists yet.

Answer #5    Answered By: Brian Ross     Answered On: Aug 28

@first check  the version that u r using, bcuz latest version of
validator support validwhen.
Otherise u can try to use requiredif either.
I've some samples whenever u want just put on a message.

Didn't find what you were looking for? Find more on problem with validwhen in validation.xml Or get search suggestion and latest updates.