yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.71k stars 935 forks source link

add name to :pattern for validation of Input component #504

Open kife-design opened 6 years ago

kife-design commented 6 years ago

I have a big form that is being validated on the server side. If the validation fails, then it will return all the errors that have occured.

So i want use a function as the :pattern method and want to check if the current field is in the errors. However, only the value is being passed to the function, so if i have to define a separate validation function for every input in the form. It would be handy is the name of the input would also be passed to the :pattern method so we can use one function to validate various fields.