Documentation
¶
Overview ¶
Package goform Generate html forms dynamically and super simple using Golang/Go.
Index ¶
- func HTMLTemplate(theme string, input string) *template.Template
- func LogOutput(format string) string
- type Element
- type ErrorItem
- type Field
- type FieldIndex
- type Form
- func (f *Form) AddCSS(fieldName string, key, value string)
- func (f *Form) AddClass(fieldName string, class string)
- func (f *Form) AddGroupClass(fieldName string, class string)
- func (f *Form) AddLabelClass(fieldName string, class string)
- func (f *Form) AddParams(fieldName string, key, value string)
- func (f *Form) DefaultGroupClass(width string)
- func (f *Form) NewButton(buttonName string)
- func (f *Form) NewElement(fieldType string, fieldName string, fieldValue string) string
- func (f *Form) NewRow(rowName string)
- func (f *Form) Render() template.HTML
- func (f *Form) RenderElements() template.HTML
- func (f *Form) SetHelpText(fieldName string, helptext string)
- func (f *Form) SetID(fieldName string, id string)
- func (f *Form) SetLabel(fieldName string, label string)
- func (f *Form) SetMultipartFormData(status string)
- func (f *Form) SetOptions(fieldName string, options []OptionItem)
- func (f *Form) SetOwnTemplateStyle(style string)
- func (f *Form) SetPlaceHolder(fieldName string, placeholder string)
- func (f *Form) SetTemplateStyle(style string)
- func (f *Form) SortElements() []Field
- type OptionItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTMLTemplate ¶
HTMLTemplate parse html template
Types ¶
type Field ¶
type Field struct { Position int FieldType string Name string ID string Classes []string CSS map[string]string Label string LabelClass []string Value string Options []OptionItem PlaceHolder string HelpText string Params map[string]string Set string GroupClass []string }
Field structure.
type FieldIndex ¶
type Form ¶
type Form struct { Name string ID string Method string Action string MultipartFormData string TemplateStyle string TemplateSource string FormTypes map[string]int Elements map[string]Field Classes []string CSS map[string]string FormText string FormTemplates map[string]*template.Template GroupClass []string }
Form structure.
func (*Form) AddGroupClass ¶
AddGroupClass adds a class to the group input.
func (*Form) AddLabelClass ¶
AddLabelClass adds a class to the label of the input.
func (*Form) AddParams ¶
AddParams add a Param value (in the form of option-value - e.g.: maxlength - 15).
func (*Form) DefaultGroupClass ¶
DefaultGroupClass set default group classes for all the elements
func (*Form) NewElement ¶
NewElement insert new form element
func (*Form) RenderElements ¶
RenderElements returns form elements generated in plain format
func (*Form) SetHelpText ¶
SetHelpText set the help-text to the input.
func (*Form) SetMultipartFormData ¶
SetMultipartFormData set style format, (html or bootstrap5: default option)
func (*Form) SetOptions ¶
func (f *Form) SetOptions(fieldName string, options []OptionItem)
SetOptions set/change the Options of the dropdown.
func (*Form) SetOwnTemplateStyle ¶
SetOwnTemplateStyle set style format, target different templates folder In case if any one need to use a custom templates
func (*Form) SetPlaceHolder ¶
SetPlaceHolder set the placeholder text to the input.
func (*Form) SetTemplateStyle ¶
SetTemplateStyle set style format, (html or bootstrap5: default option)
func (*Form) SortElements ¶
SortElements create and return empty form field