This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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 ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic