<auto-check> element
An input element that validates its value against a server endpoint.
Installation
$ npm install --save auto-check-element
Usage
Provide a URL and a CSRF token and the autocheck component will show validation confirmations and validation errors.
The endpoint should respond to POST requests with:
- a 200 HTTP status code if the provided value if valid.
- a 422 HTTP status code if the provided value is invalid.
- a optional error message in the body and a
Content-Type
header with a value oftext/html; fragment
.
Events
const check = document // Network request lifecycle events.checkcheckcheckcheck // Auto-check result events.const input = check inputinputinputinput
Browser support
Browsers without native custom element support require a polyfill.
- Chrome
- Firefox
- Safari
- Microsoft Edge
Development
npm install
npm test
License
Distributed under the MIT license. See LICENSE for details.