form.pl -- Form handling utilities
This module simplifies handling input from forms in the SWISH interface.
The values from a form can be turned into an object using
notebook.formData(form). The returned dict may be passed to a
predicate inside SWISH.
- validate_form(+Dict, +Fields) is det
- Run validate_field/4 on all specified fields, combining the
error message. Fields is a list of terms of the form
field(Name, Value, Options)
- validate_field(+Dict, +Field, -Value, +Options) is det
- True when Value is a valid value for Field from Dict according
to Options. Options is a list of processing steps taken to
convert and validate the value. Defined steps are:
- All characters must be alphanumeric
- All characters must be alphanumeric or spaces
- Convert input to an atom
- Convert input to a string
- Use Term as value if no value appears in the input.
- Convert input to lower case
- Input must be a value E-mail address.
- Input must be a valid absolute URL
- Input must be a valid absolute URL of type Scheme. Using
httpalso allows for
- Value is converted to a floating point number.
- Value is converted to an integer.
- The value must have at more than N characters
- The value must have at least N characters
- The value must have at most N characters
- The value must have at less than N characters
- Value is converted to a number (integer or float)
- Input must be a member of List.
- Input must be a reasonable password.
- Strip leading and trailing white space and normalize internal white space to a single space.
- Input is parsed as a Prolog term
The following predicates are exported, but not or incorrectly documented.