Validator: Forms custom validation reporting
See original GitHub issueWe need to update validator for form to allow the following:
[custom-validation-reporting=show-first-on-submit|show-all-on-submit|as-you-go]
can optionally appear on<form>
elements[visible-when-invalid=badInput|customError|patternMismatch|rangeOverflow|rangeUnderflow|stepMismatch|tooLong|typeMismatch|valueMissing]
and[validation-for=id-regex]
can optionally appear on any element in the document but must appear together on the element.
Here’s an example.
<form method="post"
action-xhr="/form/echo-json/post"
target="_blank"
custom-validation-reporting="show-first-on-submit">
<fieldset>
<label>
<span>Your name</span>
<input type="text" name="name" id="name4" required pattern="\w+\s\w+">
<span visible-when-invalid="valueMissing" validation-for="name4"></span>
<span visible-when-invalid="patternMismatch" validation-for="name4">
Please enter your first and last name separated by a space (e.g. Jane Miller)
</span>
</label>
<label>
<span>Your email</span>
<input type="email" name="email" id="email4" required>
<span visible-when-invalid="valueMissing" validation-for="email4"></span>
<span visible-when-invalid="typeMismatch" validation-for="email4"></span>
</label>
<input type="submit" value="Subscribe">
</fieldset>
</form>
ITI: #3343
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
How To Use Custom Form Validation in Angular - DigitalOcean
Learn how to create a custom validator in Angular for both template-driven and reactive forms.
Read more >Client-side form validation - Learn web development | MDN
This validation is completely customizable, but you need to create it all (or use a library). Using built-in form validation. One of the...
Read more >Validating form input - Angular
In reactive forms, add a custom validator by passing the function directly to the FormControl . reactive/hero-form-reactive.component.ts (validator functions)
Read more >AMP Form custom-validation-reporting interact-and-submit
The attribute 'custom-validation-reporting' in tag 'FORM [method=POST]' is set to ... It said "The validator changes are now in production.
Read more >Creating a custom validator based on the existing regular ...
To create a validation item: In the Content Editor, go to /sitecore/System/Settings/Forms/Validations . Right-click ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
amp-form visible-when-invalid has parameter tooLong,Why are there no parameters tooShort?
One more thing, we also need to whitelist
submit-success
andsubmit-error
attributes on dependents of form.This allows users to instruct form to render submit success/error messages.
If possible, also enforce that they need to have a single
template
element inside them.