forms

package
v0.0.0-...-a4c968e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Form

type Form struct {
	url.Values
	Errors errors // Custom errors map to store validation errors.
}

Form creates a custom form struct that embeds a url.Values object and holds validation errors.

func New

func New(data url.Values) *Form

New initializes a new Form struct with provided data and an empty errors map.

func (*Form) Has

func (f *Form) Has(field string) bool

Has checks if a form field exists in the post data and is not empty.

func (*Form) IsEmail

func (f *Form) IsEmail(field string)

IsEmail checks if a form field contains a valid email address using the govalidator package.

func (*Form) MinLength

func (f *Form) MinLength(field string, length int) bool

MinLength checks if a string form field meets the minimum length requirement.

func (*Form) Required

func (f *Form) Required(fields ...string)

Required checks if specified form fields are not empty.

func (*Form) Valid

func (f *Form) Valid() bool

Valid checks if the form has no validation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL