validator_base_acceptance (zotonic_mod_base v1.0.0-rc.17)

Check if an input value evaluates to true.

Can be used in combination with a check box that must be checked on submit.

For example:

<input type="checkbox" id="accept" name="accept" value="1" />
{% validate id="accept" type={acceptance} %}

Arguments

ArgumentDescriptionExample
failure\_messageMessage to be shown when the input is true. Defaults to “Must be accepted.”failure_message="Please agree to our TOS."

See also

Forms and validation

Summary

Functions

render_validator/5

validate/5

-spec validate(term(), term(), term(), list(), z:context()) ->
                  {{ok, term()}, z:context()} | {{error, term(), term()}, z:context()}.