Documentation ¶
Index ¶
- func InitTemplateLibrary()
- func Initialize[T Form](f T, initfuncs ...func(Form)) T
- func OnFinalize(funcs ...func(Form)) func(Form)
- func OnInvalid(funcs ...func(Form)) func(Form)
- func OnValid(funcs ...func(Form)) func(Form)
- func WithData(data url.Values, files map[string][]filesystem.FileHeader, r *http.Request) func(Form)
- func WithFields(fields ...fields.Field) func(Form)
- func WithInitial(initial map[string]interface{}) func(Form)
- func WithPrefix(prefix string) func(Form)
- func WithRequestData(method string, r *http.Request) func(Form)
- type BaseForm
- func (f *BaseForm) AddError(name string, errorList ...error)
- func (f *BaseForm) AddField(name string, field fields.Field)
- func (f *BaseForm) AddFormError(errorList ...error)
- func (f *BaseForm) AddWidget(name string, widget widgets.Widget)
- func (f *BaseForm) AsP() template.HTML
- func (f *BaseForm) AsUL() template.HTML
- func (f *BaseForm) BoundErrors() *orderedmap.OrderedMap[string, []error]
- func (f *BaseForm) BoundFields() *orderedmap.OrderedMap[string, BoundField]
- func (f *BaseForm) BoundForm() BoundForm
- func (f *BaseForm) CleanedData() map[string]interface{}
- func (f *BaseForm) DeleteField(name string) bool
- func (f *BaseForm) EditContext(key string, context ctx.Context)
- func (f *BaseForm) ErrorList() []error
- func (f *BaseForm) Field(name string) (fields.Field, bool)
- func (f *BaseForm) FieldOrder() []string
- func (f *BaseForm) Fields() []fields.Field
- func (f *BaseForm) FormValue(name string) interface{}
- func (f *BaseForm) FullClean()
- func (f *BaseForm) HasChanged() bool
- func (f *BaseForm) InitialData() map[string]interface{}
- func (f *BaseForm) IsValid() bool
- func (f *BaseForm) Media() media.Media
- func (f *BaseForm) OnFinalize(funcs ...func(Form))
- func (f *BaseForm) OnInvalid(funcs ...func(Form))
- func (f *BaseForm) OnValid(funcs ...func(Form))
- func (f *BaseForm) Ordering(order []string)
- func (f *BaseForm) Prefix() string
- func (f *BaseForm) Reset()
- func (f *BaseForm) SetInitial(initial map[string]interface{})
- func (f *BaseForm) SetPrefix(prefix string)
- func (f *BaseForm) SetValidators(validators ...func(Form) []error)
- func (f *BaseForm) Validate()
- func (f *BaseForm) Widget(name string) (widgets.Widget, bool)
- func (f *BaseForm) Widgets() []widgets.Widget
- func (f *BaseForm) WithData(data url.Values, files map[string][]filesystem.FileHeader, r *http.Request) Form
- type BaseFormset
- type BoundField
- type BoundForm
- type BoundFormField
- func (b *BoundFormField) Attrs() map[string]string
- func (b *BoundFormField) Errors() []error
- func (b *BoundFormField) Field() template.HTML
- func (b *BoundFormField) HTML() template.HTML
- func (b *BoundFormField) HelpText() template.HTML
- func (b *BoundFormField) ID() string
- func (b *BoundFormField) Input() fields.Field
- func (b *BoundFormField) Label() template.HTML
- func (b *BoundFormField) Name() string
- func (b *BoundFormField) Value() interface{}
- func (b *BoundFormField) Widget() widgets.Widget
- type Cleaner
- type ErrorAdder
- type FieldError
- type Form
- type FormRenderer
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTemplateLibrary ¶ added in v1.6.6
func InitTemplateLibrary()
func Initialize ¶
func OnFinalize ¶
func WithData ¶
func WithData(data url.Values, files map[string][]filesystem.FileHeader, r *http.Request) func(Form)
func WithFields ¶
func WithInitial ¶
func WithPrefix ¶
Types ¶
type BaseForm ¶
type BaseForm struct { FormPrefix string FormFields *orderedmap.OrderedMap[string, fields.Field] FormWidgets *orderedmap.OrderedMap[string, widgets.Widget] Errors *orderedmap.OrderedMap[string, []error] ErrorList_ []error Raw url.Values Initial map[string]interface{} InvalidDefaults map[string]interface{} Files map[string][]filesystem.FileHeader Cleaned map[string]interface{} Defaults map[string]interface{} Validators []func(Form) []error OnValidFuncs []func(Form) OnInvalidFuncs []func(Form) OnFinalizeFuncs []func(Form) // contains filtered or unexported fields }
func NewBaseForm ¶
func (*BaseForm) AddFormError ¶
func (*BaseForm) BoundErrors ¶
func (*BaseForm) BoundFields ¶
func (f *BaseForm) BoundFields() *orderedmap.OrderedMap[string, BoundField]
func (*BaseForm) CleanedData ¶
func (*BaseForm) DeleteField ¶
func (*BaseForm) FieldOrder ¶
func (*BaseForm) HasChanged ¶
func (*BaseForm) InitialData ¶
func (*BaseForm) OnFinalize ¶
func (*BaseForm) SetInitial ¶
func (*BaseForm) SetValidators ¶
type BaseFormset ¶
type BoundField ¶
type BoundField interface { ID() string Name() string Widget() widgets.Widget Input() fields.Field Label() template.HTML HelpText() template.HTML Field() template.HTML HTML() template.HTML Attrs() map[string]string Value() interface{} Errors() []error }
func NewBoundFormField ¶
type BoundFormField ¶
type BoundFormField struct { FormWidget widgets.Widget FormField fields.Field FormName string FormAttrs map[string]string FormValue interface{} FormErrors []error CachedHTML template.HTML }
func (*BoundFormField) Attrs ¶
func (b *BoundFormField) Attrs() map[string]string
func (*BoundFormField) Errors ¶
func (b *BoundFormField) Errors() []error
func (*BoundFormField) Field ¶
func (b *BoundFormField) Field() template.HTML
func (*BoundFormField) HTML ¶
func (b *BoundFormField) HTML() template.HTML
func (*BoundFormField) HelpText ¶
func (b *BoundFormField) HelpText() template.HTML
func (*BoundFormField) ID ¶
func (b *BoundFormField) ID() string
func (*BoundFormField) Input ¶
func (b *BoundFormField) Input() fields.Field
func (*BoundFormField) Label ¶
func (b *BoundFormField) Label() template.HTML
func (*BoundFormField) Name ¶
func (b *BoundFormField) Name() string
func (*BoundFormField) Value ¶
func (b *BoundFormField) Value() interface{}
func (*BoundFormField) Widget ¶
func (b *BoundFormField) Widget() widgets.Widget
type ErrorAdder ¶
type FieldError ¶
type Form ¶
type Form interface { FormRenderer Prefix() string SetPrefix(prefix string) SetInitial(initial map[string]interface{}) SetValidators(validators ...func(Form) []error) Ordering([]string) FieldOrder() []string Field(name string) (fields.Field, bool) Widget(name string) (widgets.Widget, bool) Fields() []fields.Field Widgets() []widgets.Widget AddField(name string, field fields.Field) AddWidget(name string, widget widgets.Widget) DeleteField(name string) bool BoundForm() BoundForm BoundFields() *orderedmap.OrderedMap[string, BoundField] BoundErrors() *orderedmap.OrderedMap[string, []error] ErrorList() []error WithData(data url.Values, files map[string][]filesystem.FileHeader, r *http.Request) Form InitialData() map[string]interface{} CleanedData() map[string]interface{} FullClean() Validate() HasChanged() bool IsValid() bool OnValid(...func(Form)) OnInvalid(...func(Form)) OnFinalize(...func(Form)) }
type FormRenderer ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.