Documentation
¶
Index ¶
- func GetTagOptions(fieldTag string) ([]fmt.KeyValue, bool)
- func ParseOptionsTag(tag string) []fmt.KeyValue
- func RegisterInput(inputs ...input.Input)
- func SetGlobalClass(classes ...string)
- type Form
- func (f *Form) ID() string
- func (f *Form) Input(fieldName string) input.Input
- func (f *Form) OnSubmit(fn func(any) error) *Form
- func (f *Form) ParentID() string
- func (f *Form) RenderHTML() string
- func (f *Form) SetOptions(fieldName string, opts ...fmt.KeyValue) *Form
- func (f *Form) SetSSR(enabled bool) *Form
- func (f *Form) SetValues(fieldName string, values ...string) *Form
- func (f *Form) SyncValues() error
- func (f *Form) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTagOptions ¶ added in v0.0.2
GetTagOptions extracts options from a struct field tag using fmt.TagPairs.
func ParseOptionsTag ¶ added in v0.0.2
ParseOptionsTag parses "key1:text1,key2:text2" format into []fmt.KeyValue.
func RegisterInput ¶ added in v0.0.2
RegisterInput registers input types for field mapping.
func SetGlobalClass ¶ added in v0.0.2
func SetGlobalClass(classes ...string)
Types ¶
type Form ¶
Form represents a form instance.
func New ¶
New creates a new Form from a struct pointer. parentID: ID of the parent DOM element where the form will be mounted. Returns an error if any exported field has no matching registered input.
func (*Form) Input ¶ added in v0.0.2
Input returns the input with the given field name, or nil if not found.
func (*Form) OnSubmit ¶ added in v0.0.2
OnSubmit sets the callback for form submission in WASM mode.
func (*Form) RenderHTML ¶ added in v0.0.2
RenderHTML renders the form based on its SSR mode.
func (*Form) SetOptions ¶ added in v0.0.2
SetOptions sets options for the input matching the given field name.
func (*Form) SetValues ¶ added in v0.0.2
SetValues sets values for the input matching the given field name.
func (*Form) SyncValues ¶ added in v0.0.2
SyncValues synchronizes all input values back to the source struct.