validate

The validator tag accepts the following arguments:

ArgumentDescriptionExample
idThe id of the input element to be validated.id=”password_field”
typeThe validator for the input element. Can be specified multiple times to add multiple validators. The value depends on the validator choosen but is always a record {validatorname arg=value ...}type=\{acceptance\}
triggerId of the element that triggers the validation. Defaults to the value of “id”. The validator is triggered by a change of this. Almost never used.trigger=”title”
targetTarget of validator, defaults to the trigger. Almost never used.
nameUse this when the name of the input element is unequal to the id. The name is used by the server side code to validate the received input. Defaults to the target argument (which defaults to id).name=”password_field”
valid_messageMessage to show when the field passes validation. Defaults to the empty string.valid_message=”ok!”
failure_messageArgument passed to the type argument. See individual validators.
message_afterThe id of the element after which the failure message should be shown. Defaults to the id argument.message_after= “signup_tos_agree”
only_on_blurNormally validates on change, unles only_on_blur is set.only_on_blur
waitTime in msec to wait for validation after the last keystroke. Default: 0.wait=100
only_on_submitWhether the validation should be done when entering data or only on submit of the form. Set this to suppress validation when entering data.only_on_submit

See also

Edit on GitHub