Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Validation Problem

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic