Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JavaScript Validation in Struts for Drop Down List

Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using client side javascript validation using struts in my struts project. I have a form that contains Name, age, address, country, state fields. I have done validation for name age and address but country and state are drop down list and validation for these is not available in validation-rules.xml. All I need to is to show a alert while submitting the form if user does not choose a country and In Country drop down box, "select a country" is appearing. How to write my own validation and where? Thanks in advance.
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can write your own validation rules in any class, but I think you should just use the validwhen rule. Just put validwhen in the depends list and set variable called test = (*this* != "Select Country...") or make the field required and put value of Select Country option to empty string.
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic