wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Validation Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validation Problem" Watch "Struts Validation Problem" New topic
Author

Struts Validation Problem

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I am stuck with this :

In my code some part of input filed is hidden and only seen if particular value from drop down table is selected !

Now when this hidden input fields are visible I`m not abale to validate them properly , I used "validwhen" but no use . Pl help me out

validation.xml



jsp page



If selected value is "PayPal" ignore the fields , i.e dont validate them but if selected "authorize", validate it

How to do this , Pl help or put some pointer or ideas , Im stuck from last 2 days !!

[ September 01, 2008: Message edited by: Sagar Rohankar ]
[ September 01, 2008: Message edited by: Sagar Rohankar ]

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

validation.xml


... cut ...
[/QB]


But... don't you have to do some validation of the actuall field also in your validwhen-statements??

I think I would write the above qouted statement like this:


One of the "secrets" is to use the label attribute of the field you are validating.
[ September 02, 2008: Message edited by: Ove Lindstr�m ]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by Ove Lindstr�m:



I think I would write the above qouted statement like this:



I tried it like this ,


with JSP code as ,



But field invalidated whether you select 'paypal' or 'authorize' , the right part of Boolean statement , like (*this* != null) , this works but not the first part , paymentOption == "authorize" , What seems to be problem here , I declared it as a String , Cant we match string like this ?

Originally posted by Ove Lindstr�m:


One of the "secrets" is to use the label attribute of the field you are validating.



What do you mean by label attribute ?
[ September 03, 2008: Message edited by: Sagar Rohankar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Validation Problem
 
Similar Threads
Struts 1.x, 2, jstl questions
Problems in struts 1 indexedListProperty
Update user profile
Validator Issue with multiply beans
Help with validation rules for form with multiple submit buttons