isneezy / confere.js

A simple promise based javascript validation library with extras
https://isneezy.github.io/confere.js/
MIT License
1 stars 1 forks source link

Auto populate the validation results to the UI #5

Closed isneezy closed 7 years ago

isneezy commented 7 years ago

It would be nice if there was a way to automatically display the error messages in the form without needing too much code.

As we know, the library already supports receiving a form with all configuration as a parameter and as proposed here would be to add a functionality, say plugin or decorators in which we specify as attribute in the form and automatically the library would know how to show the error messages in the form.

As a proposal we would have several implementations of plugins or decorators as the case of the validators, for example plugin or decorator for bootstrap, foundation, bluma, among others

Use case Example

Bootstrap html Form:

<form data-decorator="bootstrap-3">
  <div class="form-group">
    <label for="email">Email address</label>
    <input type="email" class="form-control" placeholder="Email" data-rule="required|email">
  </div>
  <input type="submit" value="Send">
</form>

Has we can see the only news here is the data-decorator form attribute, so it tels confere.js how to display the error messages, in this case it tels to display errors in bootstrap 3 format.

And there is more it should be extensive and allows the developer the flexibility in registering or providing a custom decorator/plugin to fit their needs