pull/200/head
Cory LaViska 2020-08-31 07:41:58 -04:00
rodzic 0d521167b0
commit 91196f3577
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -191,9 +191,9 @@ See the source of card, dialog, or drawer for examples.
### Form Controls
All form controls that can be validated should:
Form controls should support validation through the following conventions:
- Have an `invalid` prop that reflects its validity
- Have a `setCustomValidity()` method so the user can set a custom validation message
- Have a `reportValidity()` method that reports its validity for form submission
- Adhere to native attributes such as `required`, `pattern`, `minlength`, `maxlength`, etc. when it makes sense
- All form controls must an `invalid` prop that reflects its validity
- All form controls must have a `setCustomValidity()` method so the user can set a custom validation message
- All form controls must have a `reportValidity()` method that reports its validity during form submission
- All form controls should mirror their native validation attributes such as `required`, `pattern`, `minlength`, `maxlength`, etc. when possible

Wyświetl plik

@ -73,7 +73,7 @@ Client-side validation can be enabled through the browser's [constraint validati
When a form control is invalid, the containing form will not be submitted. Instead, the browser will show the user a relevant error message. If you don't want to use cilent-side validation, you can suppress this behavior by adding `novalidate` to the `<sl-form>` element.
Form controls that support validation include [`sl-input`](/components/input), [`sl-textarea`](/components/textarea), [`sl-select`](/components/select), and [`sl-checkbox`](/components/checkbox). Not all validation props are available for every component. Refer to each component's documentation to see which validation props it supports.
All form controls support validation, but not all validation props are available for every component. Refer to a component's documentation to see which validation props it supports.
Note that validity is not checked until the user interacts with the control or its containing form is submitted. This prevents required controls from being rendered as invalid right away, which can result in a poor user experience. If you need this behavior, set the `invalid` attribute initially.