Win a copy of Rust Web Development this week in the Other Languages 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

List Box validation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
Im having a search page .USer selects the serach criteria from the list box(say telephone and zip are the criteria) and enters the value in a text box.

I want to validate for the user should select atleast one criteria from that and the value he entered should be validated for valid telephone or zip.

Can anyone help me out.

Thanks in advance
Venkatesh Loganathan
 
venkatesh loganathan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is regd my previous mail on list box validation .FYI im using one form for all of my action classes.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand your question correctly, you can just check for valid combinations of incoming data in your action handling the form. If you don't find a valid combination, create an ActionErrors object, add an ActionError to that ActionErrors collection, save the errors with the Action.saveErrors() method, then return the appropriate action forward (back to the same form, for example). Check out the struts-example web app that comes with Struts and you'll see how to do that fairly easily.

Alternatively, you can add the validation to your form class, which is probably really the appropriate way to do it. But I don't know enough about how to do it to tell you how to proceed. Again though, if you look in the struts-example, there's code that shows how to do this for a couple of different forms. I had attributes that had a number of weird complex validation rules that made it difficult to do that in a straightforward way, so I just did it in the form handler. Learning the XML validation rules set up is the next task
reply
    Bookmark Topic Watch Topic
  • New Topic