form generator
This commit is contained in:
parent
80ae1c4f91
commit
58bd5490e2
7 changed files with 593 additions and 2 deletions
|
|
@ -82,3 +82,60 @@ type AdminCustomersPage struct {
|
|||
type AuthLockPageData struct {
|
||||
PersonName string
|
||||
}
|
||||
|
||||
// FormtablerFormFieldOption is an option for select, radio, or checkbox fields.
|
||||
type FormtablerFormFieldOption struct {
|
||||
Label string
|
||||
Value string
|
||||
Selected bool
|
||||
Checked bool
|
||||
Disabled bool
|
||||
}
|
||||
|
||||
// FormtablerFormField represents a single field in a JSON-defined form.
|
||||
type FormtablerFormField struct {
|
||||
Name string
|
||||
Label string
|
||||
Type string // "text", "email", "phone", "textarea", "password", "select", "checkbox", "radio", "toggle", "file", "number", "url", "date", "datetime-local", "color", "range", "hidden"
|
||||
Required bool
|
||||
Placeholder string
|
||||
MaxLength int
|
||||
MinLength int
|
||||
Min float64
|
||||
Max float64
|
||||
Step float64
|
||||
Pattern string
|
||||
Value string
|
||||
Options []FormtablerFormFieldOption // for select, radio, checkbox
|
||||
Autofocus bool
|
||||
Readonly bool
|
||||
Disabled bool
|
||||
Multiple bool
|
||||
Accept string // file accept attribute
|
||||
Class string
|
||||
HelpText string
|
||||
ErrorText string
|
||||
Success bool
|
||||
Error bool
|
||||
ColSpan int // for grid layout, 1-12
|
||||
}
|
||||
|
||||
// FormtablerFormDefinition is the top-level structure for a JSON-defined form.
|
||||
type FormtablerFormDefinition struct {
|
||||
ID string
|
||||
Title string
|
||||
SuccessMessage string
|
||||
Fields []FormtablerFormField
|
||||
Method string // "GET" or "POST", default "POST"
|
||||
Action string // form action URL
|
||||
SubmitText string // button text, default "Submit"
|
||||
ResetText string // button text for reset
|
||||
ShowReset bool
|
||||
Class string // form class
|
||||
Layout string // "default", "inline", "horizontal", "card"
|
||||
Columns int // number of columns (1, 2, 3), default 1
|
||||
Enctype string // form enctype
|
||||
NoValidate bool
|
||||
FieldsetTitle string // optional fieldset wrapper
|
||||
FieldsetDescription string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue