MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

mmo-validity

1 symbole · générée le 27 Oct 2026

element

mmo-validity

mmo-validity.jhs:1

Validity element to display a validity of the elements inside the mmo-validity

<mmo-validity readonly></mmo-validity>
Étend
CustomShadowElement
Use the validation API of any element inside the mmo-validity. Any element that has the property `willValidate` and is true, is checked. You MUST implement the following function in the element that is put to the validation: - property `validationMessage`: {string} the validity error message or an empty string. - property `validity`: {ValidityState} - property `willValidate`: {bool} true if the element needs to be validated - function `checkValidity()`: {bool} true if the element is valid The state is known at every key stroke (`validity`, the `change` event), but the message -- and the red border -- only show once the user is done with the field: when the focus leaves it, or when `reportValidity()` is called (a workflow's "next"). A message that came and went with each key stroke pushed the fields below, and the one beside it in a row, away from the pointer.

Index

readonlyif true, the validity is set as readonly
firstInvalidElement readonly accessorThe first control that fails, in the order of the page.
readonly accessorGet the readonly of the validity
validity readonly accessorGet the validity of the validity
willValidate readonly accessorGet the will validate of the validity
invalidElements readonly accessorGet the invalid elements of the validity
constructor()
init()
whenPointerFree(fn)Run a function once the pointer is released and its click delivered.
onFocusOut(event)The focus left a control: the user is done with it, its message can show.
reportValidity()Show the messages of the controls that fail, from now on.
refresh()Check every control again, without a word: a value set by a binding fires no input event, the state of its control was still the one it had when it was drawn.
getChangeEvent(node)Get the change event of the element
onElementChange(element, updateMessage)On element change
recordValidity(element)Record which checks a control fails.
forceValid()Clear every recorded failure, so the control reads as valid until it is checked again.
update()Update the validity of the element
updateMessage(forceValid)Update the message of the validity
checkValidity()Check the validity of the validity
(default)the controls being validated
.invalidadd a text to the validity

Attributs1

Propriétés5

firstInvalidElement

readonlyaccessormmo-validity.jhs:123

The first control that fails, in the order of the page.

get firstInvalidElement()
Type
?Element

readonly

accessormmo-validity.jhs:284

Get the readonly of the validity

get readonly() set readonly(value)
Type
boolean

validity

readonlyaccessormmo-validity.jhs:308

Get the validity of the validity

get validity()
Type
object

willValidate

readonlyaccessormmo-validity.jhs:332

Get the will validate of the validity

get willValidate()
Type
boolean

invalidElements

readonlyaccessormmo-validity.jhs:340

Get the invalid elements of the validity

get invalidElements()
Type
array

Méthodes13

whenPointerFree(fn)

mmo-validity.jhs:72

Run a function once the pointer is released and its click delivered. The focus leaves a field on the *press* of the next one: a message shown there moved that field before the release, and the click ended on whatever had come under the pointer.

whenPointerFree(fn)
fnfunction
retournevoid

onFocusOut(event)

mmo-validity.jhs:90

The focus left a control: the user is done with it, its message can show.

onFocusOut(event)
eventFocusEvent
retournevoid

reportValidity()

mmo-validity.jhs:103

Show the messages of the controls that fail, from now on.

reportValidity()
retournebooleantrue when every control is valid
if (!validity.reportValidity()) {validity.firstInvalidElement?.focus();}

refresh()

mmo-validity.jhs:115

Check every control again, without a word: a value set by a binding fires no input event, the state of its control was still the one it had when it was drawn.

refresh()
retournevoid

getChangeEvent(node)

mmo-validity.jhs:132

Get the change event of the element

getChangeEvent(node)
nodeElement- The element
retournestringThe change event

onElementChange(element, updateMessage)

mmo-validity.jhs:141

On element change

onElementChange(element, updateMessage = true)
elementElement- The element
updateMessage = trueboolean- Whether to update the message

recordValidity(element)

mmo-validity.jhs:160

Record which checks a control fails.

recordValidity(element)
elementElement
retournevoid

forceValid()

mmo-validity.jhs:187

Clear every recorded failure, so the control reads as valid until it is checked again.

forceValid()
retournevoid

updateMessage(forceValid)

mmo-validity.jhs:243

Update the message of the validity

updateMessage(forceValid = false)
forceValid = false

checkValidity()

mmo-validity.jhs:323

Check the validity of the validity

checkValidity()
retournebooleanThe validity

Slots1

Points d'accroche CSS1