Documentation ¶
Overview ¶
Package form provides types for some common forms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FieldNames = SharedFieldNames{ LanguagePreference: "language-preference", Address: AddressFieldNames{ Line1: "address-line-1", Line2: "address-line-2", Line3: "address-line-3", TownOrCity: "address-town", Postcode: "address-postcode", Action: "action", }, Select: "selected", YesNo: "yes-no", }
View Source
var YesNoValues = YesNoOptions{ Unknown: YesNoUnknown, Yes: Yes, No: No, }
Functions ¶
func DecodeAddress ¶
Types ¶
type AddressFieldNames ¶ added in v0.943.0
type AddressForm ¶
type AddressForm struct { Action string LookupPostcode string Address *place.Address FieldNames AddressFieldNames }
func NewAddressForm ¶ added in v0.943.0
func NewAddressForm() *AddressForm
func ReadAddressForm ¶
func ReadAddressForm(r *http.Request) *AddressForm
func (*AddressForm) Validate ¶
func (f *AddressForm) Validate(useYour bool) validation.List
type LanguagePreferenceForm ¶ added in v0.884.0
func ReadLanguagePreferenceForm ¶ added in v0.884.0
func ReadLanguagePreferenceForm(r *http.Request, errorLabel string) *LanguagePreferenceForm
func (*LanguagePreferenceForm) Validate ¶ added in v0.884.0
func (f *LanguagePreferenceForm) Validate() validation.List
type SelectForm ¶ added in v0.1556.0
type SelectForm[T enumType, TOptions any, TP unmarshallable[T]] struct { Selected T FieldName string Options TOptions ErrorLabel string }
func NewEmptySelectForm ¶ added in v0.1556.0
func NewEmptySelectForm[T enumType, TOptions any, TP unmarshallable[T]]( values TOptions, errorLabel string, ) *SelectForm[T, TOptions, TP]
func NewSelectForm ¶ added in v0.1556.0
func NewSelectForm[T enumType, TOptions any, TP unmarshallable[T]]( selected T, values TOptions, errorLabel string, ) *SelectForm[T, TOptions, TP]
func (*SelectForm[T, TOptions, TP]) Read ¶ added in v0.1556.0
func (f *SelectForm[T, TOptions, TP]) Read(r *http.Request)
func (*SelectForm[T, TOptions, TP]) Validate ¶ added in v0.1556.0
func (f *SelectForm[T, TOptions, TP]) Validate() validation.List
type SharedFieldNames ¶ added in v0.943.0
type SharedFieldNames struct {}
type YesNo ¶
type YesNo uint8
func ParseYesNo ¶
func (YesNo) MarshalText ¶ added in v0.912.0
func (*YesNo) UnmarshalText ¶ added in v0.1095.0
type YesNoForm ¶
type YesNoForm struct { YesNo YesNo Error error ErrorLabel string Options YesNoOptions FieldName string }
func NewYesNoForm ¶ added in v0.947.0
func (*YesNoForm) Validate ¶
func (f *YesNoForm) Validate() validation.List
type YesNoOptions ¶
Click to show internal directories.
Click to hide internal directories.