validatorjs icon indicating copy to clipboard operation
validatorjs copied to clipboard

Is it possible to use required_if with multiple values or AND 2 required_ifs together?

Open rhuang opened this issue 6 years ago • 1 comments

I would like both of these rules to kick in for a single field:

field_3: ['required_if:field_1,Y', 'required_if:field_2,N']

If field_1 === 'Y' and field_2 === 'N', then I want field_3 to be required. Is this possible? Right now it seems like it evaluates these 2 fields separately, as an OR.

rhuang avatar Feb 08 '19 03:02 rhuang

Any news on that requirement or any workaround ? This should be very usefull to have a logical AND with required_if (required_if_all ?) Thx

jlallement avatar Oct 09 '19 14:10 jlallement