Constructor
new ConstraintViolationMessages()
Properties:
Name | Type | Description |
---|---|---|
input-name |
string | if set, this indicates this element contains constraint violation messages for the input with this name inside the form this element is in. Currently doesn't affect this element's behavior, however AjaxSubmit will use it to locate where it should insert server-side errors. |
Methods
clearClientSideMessages()
Clear any client-side messages previously inserted by another element. This is useful to remove potentially out-of-date messages to replace with up-to-date ones.
- Source:
clearServerSideMessages()
Clear any server-side messages previously inserted by another element or rendered from the server. This is useful to remove potentially out-of-date messages to replace with up-to-date ones.
- Source:
createMessages(validityState, inputName)
Creates error messages based on the passed ValidityState
and input name.
This should be called as part of a Form validation event to provide a customized UX for
the error messages, beyond what the browser would do by default. The keys used are the same
as the attributes of a ValidityState
, so for example, a range underflow would mean that validity.rangeUnderflow
would return
true. Thus, a <brut-cv>
would be created with key="cv.fe.rangeUnderflow"
.
The cv.fe
is hard-coded to be consistent with Brut's server-side translation management.
Parameters:
Name | Type | Description |
---|---|---|
validityState |
ValidityState | the return from an element's |
inputName |
String | the element's |
- Source: