Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EmailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
EmailRX validates an email
Functions ¶
This section is empty.
Types ¶
type Form ¶
Form anonymously embeds a url.Values object (to hold the form data) and an Errors field to hold any validation errors for the form data.
func New ¶
New initializes a custom Form struct. Notice that this takes the form data as the parameter.
func (*Form) MatchesPattern ¶
MatchesPattern method checks a specific field in the form matches a regular expression. If the check fails then add the appropriate message to the form errors.
func (*Form) MaxLength ¶
MaxLength method checks that a specific field in the form contains a maximum number of characters. If the check fails then add the appropriate message to the form errors.
func (*Form) MinLength ¶
MinLength method checks that a specific field in the form contains a minimum number of characters. If the check fails then add the appropriate message to the form errors.
func (*Form) PermittedValues ¶
PermittedValues method checks that a specific field in the form matches one of a set of specific permitted values. If the check fails then add the appropriate message to the form errors.