forms

package
v0.0.0-...-d4b65f6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSingleWordLen

func CheckSingleWordLen(input string, SingleWordMaxLen int) bool

Types

type ErrorKey

type ErrorKey string

errorKey is a custom type for the context key

type Form

type Form struct {
	url.Values
	Errors errors
}

Form is a custom type that embeds url.Values and includes an Errors field.

func NewForm

func NewForm(data url.Values) *Form

NewForm creates a new form instance with provided data and an empty error map

func (*Form) EmailFormat

func (f *Form) EmailFormat(field string, r *http.Request) bool

EmailFormat checks if the specified field in the form data matches a valid email format

func (*Form) First_LastName_Min_Max_Len

func (f *Form) First_LastName_Min_Max_Len(field string, minLen, maxLen int, r *http.Request) bool

First_LastName_Min_Max_Len checks if the length of a field in the form data is within the specified range

func (*Form) Has

func (f *Form) Has(field string, r *http.Request) bool

Has checks if the specified field exists in the form data

func (*Form) PassFormat

func (f *Form) PassFormat(field string, minL, maxL int, r *http.Request) bool

PassFormat checks if the specified field in the form data matches certain password format criteria

func (*Form) Required

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

Required checks if specified fields are present and not empty in the form data

func (*Form) Valid

func (f *Form) Valid() bool

Valid checks if there are any errors in the form data

Jump to

Keyboard shortcuts

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