form

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSelectTag

func NewSelectTag(opts tags.Options) *tags.Tag

NewSelectTag constructs a new `<select>` tag.

Types

type Form

type Form struct {
	*tags.Tag
}

Form is the html form tag, this will hold other tags inside it.

func New

func New(opts tags.Options) *Form

New creates a new form from passed options, it sets defaults for method and also handles other methods as PUT by adding _method hidden input.

func (Form) CheckboxTag

func (f Form) CheckboxTag(opts tags.Options) *tags.Tag

CheckboxTag builds a checkbox from the options passed

func (Form) DateTimeTag

func (f Form) DateTimeTag(opts tags.Options) *tags.Tag

DateTimeTag generates a tag with type datetime-local and adds default format to be 2006-01-02T03:04

func (Form) FileTag

func (f Form) FileTag(opts tags.Options) *tags.Tag

FileTag builds an input[type=file] from the options passed, it also sets the form enctype to be "multipart/form-data"

func (Form) HiddenTag

func (f Form) HiddenTag(opts tags.Options) *tags.Tag

HiddenTag generates and input tag with type hidden

func (Form) InputTag

func (f Form) InputTag(opts tags.Options) *tags.Tag

InputTag generates an input tag with passed options, by default will be type=text.

func (Form) Label

func (f Form) Label(value string, opts tags.Options) *tags.Tag

Label permits to create a label inside a Form

func (Form) RadioButton

func (f Form) RadioButton(opts tags.Options) *tags.Tag

RadioButton creates a radio button for a form with the passed options

func (Form) RadioButtonTag

func (f Form) RadioButtonTag(opts tags.Options) *tags.Tag

RadioButtonTag creates a radio button for a form with the passed options

func (Form) SelectTag

func (f Form) SelectTag(opts tags.Options) *tags.Tag

SelectTag constructs a new `<select>` tag from a form.

func (*Form) SetAuthenticityToken

func (f *Form) SetAuthenticityToken(s string)

SetAuthenticityToken allows tags to work smoothly with Buffalo, it receives the auth token and creates an input hidden with it.

func (Form) SubmitTag

func (f Form) SubmitTag(value string, opts tags.Options) *tags.Tag

SubmitTag generates an input tag with type "submit"

func (Form) TextArea

func (f Form) TextArea(opts tags.Options) *tags.Tag

TextArea creates a textarea for a form with passed options

func (Form) TextAreaTag

func (f Form) TextAreaTag(opts tags.Options) *tags.Tag

TextAreaTag creates a textarea for a form with passed options

type FormFor

type FormFor struct {
	*Form
	Model interface{}

	Errors tags.Errors
	// contains filtered or unexported fields
}

FormFor is a form made for a struct

func NewFormFor

func NewFormFor(model interface{}, opts tags.Options) *FormFor

NewFormFor creates a new Formfor with passed options, it also creates the id of the form from the struct name and adds errors if present.

func (FormFor) CheckboxTag

func (f FormFor) CheckboxTag(field string, opts tags.Options) *tags.Tag

CheckboxTag creates a checkbox for a field on the form Struct

func (FormFor) DateTimeTag

func (f FormFor) DateTimeTag(field string, opts tags.Options) *tags.Tag

DateTimeTag creates a input[type=datetime-local] for a field name passed

func (FormFor) FileTag

func (f FormFor) FileTag(field string, opts tags.Options) *tags.Tag

FileTag creates a input[type=file] for a field name passed

func (FormFor) HiddenTag

func (f FormFor) HiddenTag(field string, opts tags.Options) *tags.Tag

HiddenTag adds a wrappter for input type hidden on the form

func (FormFor) InputTag

func (f FormFor) InputTag(field string, opts tags.Options) *tags.Tag

InputTag creates an input for a field on the form Struct

func (FormFor) RadioButton

func (f FormFor) RadioButton(field string, opts tags.Options) *tags.Tag

RadioButton creates a radio button for a struct field

func (FormFor) RadioButtonTag

func (f FormFor) RadioButtonTag(field string, opts tags.Options) *tags.Tag

RadioButtonTag creates a radio button for a struct field

func (FormFor) SelectTag

func (f FormFor) SelectTag(field string, opts tags.Options) *tags.Tag

SelectTag creates a select tag for a specified struct field and loads options from the options opject

func (FormFor) SubmitTag

func (f FormFor) SubmitTag(value string, opts tags.Options) *tags.Tag

SubmitTag adds a submit button to the form

func (FormFor) TextArea

func (f FormFor) TextArea(field string, opts tags.Options) *tags.Tag

TextArea creates text area for the specified struct field

func (FormFor) TextAreaTag

func (f FormFor) TextAreaTag(field string, opts tags.Options) *tags.Tag

TextAreaTag creates text area for the specified struct field

type SelectOption

type SelectOption struct {
	Value       interface{}
	Label       interface{}
	Selected    bool
	Placeholder bool
}

SelectOption describes a HTML <select> tag <option> meta data.

func (SelectOption) String

func (s SelectOption) String() string

type SelectOptions

type SelectOptions []SelectOption

SelectOptions is a slice of SelectOption

type SelectTag

type SelectTag struct {
	*tags.Tag
	SelectedValue interface{}

	SelectOptions SelectOptions
	// contains filtered or unexported fields
}

SelectTag describes a HTML <select> tag meta data.

func (SelectTag) HTML

func (s SelectTag) HTML() template.HTML

HTML gives the HTML template representation for the select tag.

func (SelectTag) String

func (s SelectTag) String() string

type Selectable

type Selectable interface {
	SelectValue() interface{}
	SelectLabel() string
}

Selectable allows any struct to become an option in the select tag.

type SelectableMultiple

type SelectableMultiple interface {
	IsSelected() bool
}

SelectableMultiple allows any struct to add Selected option in the select tag.

type SelectableMultiples

type SelectableMultiples []SelectableMultiple

SelectableMultiples is the plural for SelectableMultiple

type Selectables

type Selectables []Selectable

Selectables is the plural for selectable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL