Sunday, 23 April 2017

Node Js Express Validator required field only if another have a specific value

I use express-validator to check my post fields. My Problem is I want to make some fields required only if other fields have a specific values. eg:

if person_organisation is true:
person_organisation_name must be required

if person_organisation is false:
person_first_name must be required

Is there any way to put this rules in Validation Schema??



via medKHELIFI

No comments:

Post a Comment