Documentation ¶
Index ¶
- Variables
- func Complete(c *web.Context, form interface{}, texts *Text) bool
- func GetXSRFToken(c *web.Context) string
- func IsXSRFTokenValid(c *web.Context, token string) bool
- type CheckboxField
- func (t *CheckboxField) Bind(c *web.Context, texts *Text)
- func (t *CheckboxField) GetRenderDetails() (name, desc, caption, err string)
- func (t *CheckboxField) HTML() template.HTML
- func (t *CheckboxField) Render(buffer *bytes.Buffer)
- func (t *CheckboxField) RowHTML() template.HTML
- func (t *CheckboxField) SetAttribute(key, value string)
- type DateTimeField
- func (t *DateTimeField) Bind(c *web.Context, texts *Text)
- func (t *DateTimeField) GetRenderDetails() (name, desc, caption, err string)
- func (t *DateTimeField) HTML() template.HTML
- func (t *DateTimeField) Render(buffer *bytes.Buffer)
- func (t *DateTimeField) RowHTML() template.HTML
- func (t *DateTimeField) SetAttribute(key, value string)
- type DateTimeInputType
- type Field
- type FileField
- func (t *FileField) Bind(c *web.Context, texts *Text)
- func (t *FileField) GetRenderDetails() (name, desc, caption, err string)
- func (t *FileField) HTML() template.HTML
- func (t *FileField) Render(buffer *bytes.Buffer)
- func (t *FileField) RowHTML() template.HTML
- func (t *FileField) SetAttribute(key, value string)
- type InputField
- func (t *InputField) Bind(c *web.Context, texts *Text)
- func (t *InputField) GetRenderDetails() (name, desc, caption, err string)
- func (t *InputField) HTML() template.HTML
- func (t *InputField) Render(buffer *bytes.Buffer)
- func (t *InputField) RowHTML() template.HTML
- func (t *InputField) SetAttribute(key, value string)
- type InputType
- type MultiCheckbox
- func (t *MultiCheckbox) Bind(c *web.Context, texts *Text)
- func (t *MultiCheckbox) GetRenderDetails() (name, desc, caption, err string)
- func (t *MultiCheckbox) HTML() template.HTML
- func (t *MultiCheckbox) Render(buffer *bytes.Buffer)
- func (t *MultiCheckbox) RowHTML() template.HTML
- func (t *MultiCheckbox) SetAttribute(key, value string)
- type NumberField
- func (t *NumberField) Bind(c *web.Context, texts *Text)
- func (t *NumberField) GetRenderDetails() (name, desc, caption, err string)
- func (t *NumberField) HTML() template.HTML
- func (t *NumberField) Render(buffer *bytes.Buffer)
- func (t *NumberField) RowHTML() template.HTML
- func (t *NumberField) SetAttribute(key, value string)
- func (t *NumberField) ValueNoNil() int64
- type Option
- type SelectField
- func (t *SelectField) Bind(c *web.Context, texts *Text)
- func (t *SelectField) GetRenderDetails() (name, desc, caption, err string)
- func (t *SelectField) HTML() template.HTML
- func (t *SelectField) Render(buffer *bytes.Buffer)
- func (t *SelectField) RowHTML() template.HTML
- func (t *SelectField) SetAttribute(key, value string)
- type Text
- type UploadedFile
- type XSRFField
- func (t *XSRFField) Bind(c *web.Context, texts *Text)
- func (t *XSRFField) GetRenderDetails() (name, desc, caption, err string)
- func (t *XSRFField) HTML() template.HTML
- func (t *XSRFField) Render(buffer *bytes.Buffer)
- func (t *XSRFField) RowHTML() template.HTML
- func (t *XSRFField) SetAttribute(name, value string)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultText = Text{
ErrorRequired: "This field is required",
ErrorTooLong: "This value is too long",
ErrorTooShort: "This value is too short",
ErrorInvalidEmail: "This is not a valid e-mail address",
ErrorInvalidWebsite: "This is not a valid website address",
ErrorInvalidDate: "This is not a valid date (expected YYYY-MM-DD)",
ErrorValueBelowMin: "The minimum accepted value is %v",
ErrorValueAboveMax: "The maximum accepted value is %v",
}
DefaultText is the default texts used by the package
View Source
var XSRFTokenGenerator = func(c *web.Context, seed int64) string {
return ""
}
View Source
var XSRFTokenValidTime = time.Hour
Functions ¶
func Complete ¶
Complete checks if the current request is a POST, and if so binds all form.Fields from the given form
func GetXSRFToken ¶
Types ¶
type CheckboxField ¶
type CheckboxField struct { // configurable by user Name string Caption string Required bool Description string Attributes map[string]string // readable value Error string Value bool }
func (*CheckboxField) GetRenderDetails ¶
func (t *CheckboxField) GetRenderDetails() (name, desc, caption, err string)
func (*CheckboxField) HTML ¶
func (t *CheckboxField) HTML() template.HTML
func (*CheckboxField) Render ¶
func (t *CheckboxField) Render(buffer *bytes.Buffer)
func (*CheckboxField) RowHTML ¶
func (t *CheckboxField) RowHTML() template.HTML
func (*CheckboxField) SetAttribute ¶
func (t *CheckboxField) SetAttribute(key, value string)
type DateTimeField ¶
type DateTimeField struct { // configurable by user Type DateTimeInputType Name string Caption string Required bool Description string MinDate *time.Time MaxDate *time.Time Placeholder *time.Time Attributes map[string]string // readable value Error string Value *time.Time }
func (*DateTimeField) GetRenderDetails ¶
func (t *DateTimeField) GetRenderDetails() (name, desc, caption, err string)
func (*DateTimeField) HTML ¶
func (t *DateTimeField) HTML() template.HTML
func (*DateTimeField) Render ¶
func (t *DateTimeField) Render(buffer *bytes.Buffer)
func (*DateTimeField) RowHTML ¶
func (t *DateTimeField) RowHTML() template.HTML
func (*DateTimeField) SetAttribute ¶
func (t *DateTimeField) SetAttribute(key, value string)
type DateTimeInputType ¶
type DateTimeInputType int
const ( DateTimeInputDateTimeLocal DateTimeInputType = iota DateTimeInputDate DateTimeInputTime )
type Field ¶
type FileField ¶
type FileField struct { // configurable by user Name string Caption string Required bool Description string Attributes map[string]string // readable value Error string Value *UploadedFile }
func (*FileField) GetRenderDetails ¶
func (*FileField) SetAttribute ¶
type InputField ¶
type InputField struct { // configurable by user Type InputType Name string Caption string Required bool Description string MaxLength int MinLength int Regexp *regexp.Regexp RegexpError string Placeholder string Attributes map[string]string // readable value Error string Value string }
func (*InputField) GetRenderDetails ¶
func (t *InputField) GetRenderDetails() (name, desc, caption, err string)
func (*InputField) HTML ¶
func (t *InputField) HTML() template.HTML
func (*InputField) Render ¶
func (t *InputField) Render(buffer *bytes.Buffer)
func (*InputField) RowHTML ¶
func (t *InputField) RowHTML() template.HTML
func (*InputField) SetAttribute ¶
func (t *InputField) SetAttribute(key, value string)
type MultiCheckbox ¶
type MultiCheckbox struct { // configurable by user Name string Caption string Description string Options []*Option Attributes map[string]string // readable value Error string Value interface{} }
func (*MultiCheckbox) GetRenderDetails ¶
func (t *MultiCheckbox) GetRenderDetails() (name, desc, caption, err string)
func (*MultiCheckbox) HTML ¶
func (t *MultiCheckbox) HTML() template.HTML
func (*MultiCheckbox) Render ¶
func (t *MultiCheckbox) Render(buffer *bytes.Buffer)
func (*MultiCheckbox) RowHTML ¶
func (t *MultiCheckbox) RowHTML() template.HTML
func (*MultiCheckbox) SetAttribute ¶
func (t *MultiCheckbox) SetAttribute(key, value string)
type NumberField ¶
type NumberField struct { // configurable by user Name string Caption string Required bool Description string Min *int64 Max *int64 Placeholder string Attributes map[string]string // readable value Error string Value *int64 }
func (*NumberField) GetRenderDetails ¶
func (t *NumberField) GetRenderDetails() (name, desc, caption, err string)
func (*NumberField) HTML ¶
func (t *NumberField) HTML() template.HTML
func (*NumberField) Render ¶
func (t *NumberField) Render(buffer *bytes.Buffer)
func (*NumberField) RowHTML ¶
func (t *NumberField) RowHTML() template.HTML
func (*NumberField) SetAttribute ¶
func (t *NumberField) SetAttribute(key, value string)
func (*NumberField) ValueNoNil ¶
func (t *NumberField) ValueNoNil() int64
type SelectField ¶
type SelectField struct { // configurable by user Name string Caption string Required bool Description string Options []*Option Attributes map[string]string // readable value Error string Value interface{} }
func (*SelectField) GetRenderDetails ¶
func (t *SelectField) GetRenderDetails() (name, desc, caption, err string)
func (*SelectField) HTML ¶
func (t *SelectField) HTML() template.HTML
func (*SelectField) Render ¶
func (t *SelectField) Render(buffer *bytes.Buffer)
func (*SelectField) RowHTML ¶
func (t *SelectField) RowHTML() template.HTML
func (*SelectField) SetAttribute ¶
func (t *SelectField) SetAttribute(key, value string)
type Text ¶
type Text struct { ErrorRequired string ErrorTooLong string ErrorTooShort string ErrorInvalidEmail string ErrorInvalidWebsite string ErrorInvalidDate string ErrorValueBelowMin string ErrorValueAboveMax string }
Text is a collection of text strings used by the package
type UploadedFile ¶
type UploadedFile struct { Filename string ContentType string File io.ReadSeeker }
func (*UploadedFile) Bytes ¶
func (u *UploadedFile) Bytes() []byte
Click to show internal directories.
Click to hide internal directories.