Search code examples
vue.jsbootstrap-vuevee-validate

vee-validate 3.x. validate "required value if only another value is null"


vee-validate 3.x.

I want to validate "required value if only another value is null".

Refereing "Cross Field Validation", I tried to create a such a validator.

        validate: function (value, another) {
            return another.value != null || value != null;
        }

but the validate function is not called when value is null.

how to create such a validator? or how to do that the function is called when value is null?

Thanks for reading my poor English.


Solution

  • Using bootstrap-vue 2.x, I sovled the problem by myself.

     <validation-provider name="REQUIRE_ONE"
        :rules='{ required: another == null}' v-slot='v-slot-1'>