Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement directive for form validation #4

Open
iErik opened this issue Nov 15, 2018 · 0 comments
Open

Implement directive for form validation #4

iErik opened this issue Nov 15, 2018 · 0 comments
Labels
proposal A feature proposal to be discussed with the team.

Comments

@iErik
Copy link
Contributor

iErik commented Nov 15, 2018

Currently we have two ways to define form validation rules using the FormValidator mixin:

  • By providing a validation option object in the root of the component, containing the validation rules for the component forms, whether scoped or not.

  • By calling the this.$validator.init(<options object>) method from the component. The $validator.init method accepts a option object that follows the same standard as the validation option object in the root of the component.

Bu perhaps we could also add a way for the user to define it's validation rules in the template, using a directive:

<input
  type="text"
  name="fullName"
  v-validator="required"
  v-model="fullName"
/>

Although the library would no longer be strictly model-based nor completely decoupled from templates, using a directive may be a better option for smaller forms.

@iErik iErik added the proposal A feature proposal to be discussed with the team. label Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A feature proposal to be discussed with the team.
Projects
None yet
Development

No branches or pull requests

1 participant