Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<form") TagClose = []byte("</form>") AttrAction = []byte(" action=\"") AttrMethod = []byte(" method=\"") AttrAcceptCharset = []byte(" accept-charset=\"") AttrAutoCapitalize = []byte(" autocapitalize=\"") AttrAutoComplete = []byte(" autocomplete=\"") AttrEncType = []byte(" enctype=\"") AttrName = []byte(" name=\"") AttrNoValidate = []byte(" novalidate") AttrRel = []byte(" rel=\"") AttrTarget = []byte(" target=\"") )
Byte constants for HTML rendering.
Functions ¶
func Dialog ¶ added in v0.3.0
Dialog Creates a form with method="dialog" that closes the nearest ancestor dialog element when submitted. The form's return value is set to the value of the submit button used. Example: form.Dialog(button.Submit("Confirm"), button.Button("Cancel")) Renders: <form method="dialog"><button type="submit">Confirm</button><button type="button">Cancel</button></form>
func Get ¶
Get Creates a form with GET method and specified action URL. Use for search forms and other idempotent queries where the data appears in the URL. Example: form.Get("/search", input.Text("q", "")) Renders: <form action="/search" method="get"><input name="q" type="text" /></form>
func New ¶
New Creates a new form element with child nodes. Example: form.New(input.Text("name", ""), button.Submit("Send")) Renders: <form><input name="name" type="text" /><button type="submit">Send</button></form>
func Post ¶
Post Creates a form with POST method and specified action URL. Use for forms that modify data on the server (login, registration, creating records). Example: form.Post("/login", input.Email("email"), input.Password("password")) Renders: <form action="/login" method="post"><input name="email" type="email" /><input name="password" type="password" /></form>