I’m using MVC Data Anottation for client validations.
How do you implement this simple scenario:
Mark a field as required only if one radio button is selected
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you wrote you’re doing client side validation, so one way to accomplish your goal would be a simple javascript that would remove / modify validation rules attached to your input element:
you can find out more about validation plugin and its features here http://docs.jquery.com/Plugins/Validation/rules#.22add.22rules
Of course you can easily find out more about jquery unobutrusive validation and do your variant. Thing to remember though is that you want to keep your client-side and backend validation consistent, so if you strip the [Required] from the model, you would have to check the value in your save/edit method.