validator_base_presence (zotonic_mod_base v1.0.0-rc.17)

Check if an input has been filled in or checked.

For example when a title must be entered:

<input type="text" id="title" name="title" value="" />
{% validate id="title" type={presence} %}

Arguments

ArgumentDescriptionExample
failure\_messageMessage to be shown when field is empty. Defaults to “\*”failure_message="Please enter."

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()}.