Skip to content

luqman/ember-error-for

Repository files navigation

ember-error-for

Simple wrapper for javascript constraint error messages.

It should satisfy very simple forms.

Demo

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-error-for

Usage

It renders a span tag with [hidden] attribute set.

  <form>
    <input type="text" name="username" required>
    <ErrorFor @name="username" />
    <input type="submit">
  </form>

Now instead of getting the default browser error message bubble, it will render the error inline.

All possible validations related attributes can be found here.

You can override error messages by passing in one of the ValidityState properties.

e.g.

  <form>
    <input type="text" name="username" required>
    <ErrorFor @name="username"
      @valueMissing="Please provider your username" />
    <input type="submit">
  </form>

Todo

  • Add more tests

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published