Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Skip validation of a field

 
Srihari Injeti
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement where I need to skip validating a field if a check box is checked. How can I use validwhen to achieve this.

Thanks

Sri
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the section entitled "Designing Complex Validations with ValidWhen" in this link.

The entry would probably look something like this:


[ September 07, 2006: Message edited by: Merrill Higginson ]
 
Srihari Injeti
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I was doing the same. It works for me as long as the second field is empty.

If the second field is not empty, then it passes the validwhen, and starts validating against the subsequent validators mentioned.

One solution is to blank out the second field when the first checkbox is checked, as we dont intend to validate the second field.

But the requirement is not to blank out the field. For instance, if the user changes his mind, we would like to keep whatever was entered.

I was hoping I can do this without writing a custom validator.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While the validWhen validator is handy, it's not solution for every possible validation scenario. It sounds like in order to meet all your requirements, you may have to create a custom validation rule.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic