diff --git a/README.md b/README.md index cf3e744..fef1819 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,14 @@ input.addEventListener('auto-check-complete', function(event) { [CSRF]: https://en.wikipedia.org/wiki/Cross-site_request_forgery [Response]: https://developer.mozilla.org/en-US/docs/Web/API/Response +## Manually Trigger Validation + +The `triggerValidation()` function can be used to manually trigger the `` element. + +```js +document.getElementById('input-element').closest('auto-check').triggerValidation() +``` + ## Browser support Browsers without native [custom element support][support] require a [polyfill][]. diff --git a/custom-elements.json b/custom-elements.json index 3ab9ad2..91e3c81 100644 --- a/custom-elements.json +++ b/custom-elements.json @@ -155,6 +155,15 @@ "kind": "field", "name": "onloadend" }, + { + "kind": "method", + "name": "triggerValidation", + "return": { + "type": { + "text": "void" + } + } + }, { "kind": "field", "name": "input", @@ -205,14 +214,6 @@ "type": { "text": "boolean" } - }, - { - "kind": "field", - "name": "onlyValidateOnBlur", - "type": { - "text": "boolean" - }, - "readonly": true } ], "attributes": [ diff --git a/examples/index.html b/examples/index.html index 2986fe8..60ba5fe 100644 --- a/examples/index.html +++ b/examples/index.html @@ -37,19 +37,6 @@

only-validate-on-blur with custom validity messages

- -
-

All fields marked with * are required

- - - - -

-
- -