vue.js - Vue validator multiple input field -


how can validate form group (select + input text) require @ least 1 of 2 vue-validator.js? thanks.. e.g.

<select> <option>select one..</option> <option>option 1</option> <option>option 2</option> <option>option 3</option> </select> <input type="text" placeholder="or type here.." /> 

you should have select , input have same v-model attribute , set validation on 1 of them. this:

<select v-model="modelname" v-validate:modelname="{required:true}"> <option>select one..</option> <option>option 1</option> <option>option 2</option> <option>option 3</option> </select> <input v-model="modelname" type="text" placeholder="or type here.." /> <span v-show="$validation.modelname.required">this field required</span> 

and of course of form should wrapped in validator component this:

 <validator name="validation">  </validator> 

but assume you're doing this.


Comments