This week's book giveaway is in the Raspberry Pi forum.
We're giving away four copies of Getting started with Java on the Raspberry Pi and have Frank DelPorte on-line!
See this thread for details.
Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Struts Validation Problem

 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic