Capture form validation back from the browser
Hyperform is a complete implementation of the HTML 5 form validation API in Javascript. It replaces or polyfills the browser’s native methods and eases your validation task with custom events and hooks.
Hyperform is neatly packed in a single Javascript file, weights only 36kB (10.3kB gzipped!) and includes:
-
a full, working and compliant implementation of the whole HTML 5 constraint API
assert(input.validity.valid); -
polyfills and ponyfills for other useful methods like
valueAsNumberorstepUp// polyfill: assert(input.valueAsNumber === 123); // ponyfill: hyperform.stepUp(input); // instead of input.stepUp() -
new events
form.addEventListener('validate', function(event) { // stop the engines! event.preventDefault(); }); -
easily customizable error messages
<input required data-value-missing="No chance! Fill it already."> -
fine-grained control over the display of messages
.hf_warning { border-color: pink; } -
and all this licensed under the terms of the MIT license
