Documentation ¶
Index ¶
- func GetValidFormData(w *wrapper.Wrapper, post interface{}) error
- type Field
- type Form
- func (f *Form) AddCheckBox(k string) *Field
- func (f *Form) AddRadio(k string, o []map[string]string) *Field
- func (f *Form) AddRepeatSection(k string, b string, fs []*Field) *Field
- func (f *Form) AddSelect(k string, o []map[string]string) *Field
- func (f *Form) AddText(k string, t string) *Field
- func (f *Form) AddTextArea(k string) *Field
- func (f *Form) Register(w *wrapper.Wrapper) error
- type FormRegister
- type TemplateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValidFormData ¶
Types ¶
type Field ¶
type Field struct { Type string `json:"type" bson:"type"` Hide bool `json:"hide,omitempty" bson:"hide,omitempty"` Key string `json:"key" bson:"key"` TemplateOptions *TemplateOptions `json:"templateOptions" bson:"templateOptions"` HideExpression string `json:"hideExpression,omitempty" bson:"hideExpression"` Validator string `json:"-" bson:"validator,omitempty"` }
Form fields structure
func (*Field) AddHideExpression ¶
type Form ¶
type Form struct { Fields []*Field `json:"formFields"` FormData interface{} `json:"formData"` FormId bson.ObjectId `json:"formId"` }
Basic form structure, required by Formly
func (*Form) AddRepeatSection ¶
Add a radio button to form
type FormRegister ¶
type FormRegister struct { FormFields []*Field `bson:"fields"` FormId bson.ObjectId `bson:"_id"` SessionId bson.ObjectId `bson:"session_id"` Created time.Time `bson:"created"` }
Structure for form registration
func GetFormRegister ¶
func GetFormRegister(i string, w *wrapper.Wrapper) (*FormRegister, error)
Retrieve a previously registered form by id
func GetValidRegForm ¶
func GetValidRegForm(i string, w *wrapper.Wrapper) (*FormRegister, error)
Retrieve valid form based on id and session id
func (*FormRegister) ValidateRequired ¶
func (fr *FormRegister) ValidateRequired(data map[string]interface{}) map[string]string
Check for missing required fields.
type TemplateOptions ¶
type TemplateOptions struct { Options []map[string]string `json:"options,omitempty" bson:"options,omitempty"` Label string `json:"label,omitempty" bson:"label"` Required bool `json:"required,omitempty" bson:"required"` Placeholder string `json:"placeholder,omitempty" bson:"placeholder,omitempty"` Rows int `json:"rows,omitempty" bson:"rows,omitempty"` Cols int `json:"cols,omitempty" bson:"cols,omitempty"` Fields []*Field `json:"fields,omitempty" bson:"fields,omitempty"` ButtonText string `json:"btnText,omitempty" bson:"btnText,omitempty"` }
Click to show internal directories.
Click to hide internal directories.