Documentation ¶
Index ¶
- func Clear(ctx echo.Context)
- func Get[T any](ctx echo.Context) *T
- func Submit(ctx echo.Context, form Form) error
- type Form
- type Submission
- func (f *Submission) FieldHasErrors(fieldName string) bool
- func (f *Submission) GetFieldErrors(fieldName string) []string
- func (f *Submission) GetFieldStatusClass(fieldName string) string
- func (f *Submission) IsDone() bool
- func (f *Submission) IsSubmitted() bool
- func (f *Submission) IsValid() bool
- func (f *Submission) SetFieldError(fieldName string, message string)
- func (f *Submission) Submit(ctx echo.Context, form any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Form ¶ added in v0.13.0
type Form interface { // Submit marks the form as submitted, stores a pointer to it in the context, binds the request // values to the struct fields, and validates the input based on the struct tags. // Returns a validator.ValidationErrors if the form values were not valid. // Returns an echo.HTTPError if the request failed to process. Submit(c echo.Context, form any) error // IsSubmitted returns true if the form was submitted IsSubmitted() bool // IsValid returns true if the form has no validation errors IsValid() bool // IsDone returns true if the form was submitted and has no validation errors IsDone() bool // FieldHasErrors returns true if a given struct field has validation errors FieldHasErrors(fieldName string) bool // SetFieldError sets a validation error message for a given struct field SetFieldError(fieldName string, message string) // GetFieldErrors returns the validation errors for a given struct field GetFieldErrors(fieldName string) []string // GetFieldStatusClass returns a CSS class to be used for a given struct field GetFieldStatusClass(fieldName string) string }
Form represents a form that can be submitted and validated
type Submission ¶
type Submission struct {
// contains filtered or unexported fields
}
Submission represents the state of the submission of a form, not including the form itself. This satisfies the Form interface.
func (*Submission) FieldHasErrors ¶
func (f *Submission) FieldHasErrors(fieldName string) bool
func (*Submission) GetFieldErrors ¶
func (f *Submission) GetFieldErrors(fieldName string) []string
func (*Submission) GetFieldStatusClass ¶
func (f *Submission) GetFieldStatusClass(fieldName string) string
func (*Submission) IsDone ¶
func (f *Submission) IsDone() bool
func (*Submission) IsSubmitted ¶
func (f *Submission) IsSubmitted() bool
func (*Submission) IsValid ¶ added in v0.13.0
func (f *Submission) IsValid() bool
func (*Submission) SetFieldError ¶
func (f *Submission) SetFieldError(fieldName string, message string)
func (*Submission) Submit ¶ added in v0.13.0
func (f *Submission) Submit(ctx echo.Context, form any) error
Click to show internal directories.
Click to hide internal directories.