I have a review form. it has 4 fields, title, category, link, and review
if category is a website, then link is required. if it is a book, link is optional, not required. how do I validate the link field?
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.
Checkout the following blog post which illustrates some custom validators such as
RequiredIfthat allow you to achieve this conditional validation.Or if you are like me and prefer imperative validation logic rather than declarative simply use FluentValidation.NET which makes this validation scenario pretty trivial.