3

I am trying to design a page that has two radio button options and two text boxes with each radio button. I am validating these text boxes using data annotation validation attribute. I am using jquery slider.toggle() to display each text boxes according to the radio button clicked. When i submit the page, required field validators of both text boxes are triggered. What I want to do is to disable the first text box validation when the second radio button is clicked. Is there any method in MVC to disable the validation of text boxes when the radio button associated to it is not selected?

Joseph
  • 25
  • 3
  • 1
    http://stackoverflow.com/questions/7390902/requiredif-conditional-validation-attribute – VJAI Oct 18 '12 at 09:19

1 Answers1

0

This can be done rather simply front end. The validation which occurs is done based on html5's data attribute. Remove the data attributes from an input element and the validation will cease to function.

Travis J
  • 81,153
  • 41
  • 202
  • 273