// InputTime creates a time based input box func InputTime(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "time" if id != "" { i.SetID(id) } return i }
// InputColor creates a colour based input box, the workings of which are // implementation specific func InputColor(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "color" if id != "" { i.SetID(id) } return i }
// InputMonth creates a month based input box func InputMonth(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "month" if id != "" { i.SetID(id) } return i }
// InputWeek creates a week based input box func InputWeek(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "week" if id != "" { i.SetID(id) } return i }
// InputUpload creates an upload input field func InputUpload(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "file" if id != "" { i.SetID(id) } return i }
// InputDateTimeLocal create a local datetime based input, the workings of // which are implementation specific func InputDateTimeLocal(id string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "datetime-local" if id != "" { i.SetID(id) } return i }
// InputURL is a text box that validates as a URL func InputURL(id, value string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "url" i.Value = value if id != "" { i.SetID(id) } return i }
// InputPassword creates a password input func InputPassword(id, value string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "password" i.Value = value if id != "" { i.SetID(id) } return i }
// InputButton creates a button input func InputButton(id, name string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "button" i.Value = name if id != "" { i.SetID(id) } return i }
// InputCheckbox creates a checkbox input func InputCheckbox(id string, value bool) *dom.HTMLInputElement { i := xdom.Input() i.Type = "checkbox" if id != "" { i.SetID(id) } i.Checked = value return i }
// InputText creates a text input box func InputText(id, value string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "text" if id != "" { i.SetID(id) } i.Value = value return i }
// InputRadio create a radio button input func InputRadio(id, name string, value bool) *dom.HTMLInputElement { i := xdom.Input() i.Type = "radio" i.Name = name if id != "" { i.SetID(id) } i.Checked = value return i }
// InputNumber creates a text input that only allows number to be entered func InputNumber(id string, min, max, value float64) *dom.HTMLInputElement { i := xdom.Input() i.Type = "number" i.Min = strconv.FormatFloat(min, 'f', -1, 64) i.Max = strconv.FormatFloat(max, 'f', -1, 64) i.ValueAsNumber = value if id != "" { i.SetID(id) } return i }
// InputRange creates a sliding rule with which a number in the given range // can be selected func InputRange(id string, min, max, step, value float64) *dom.HTMLInputElement { i := xdom.Input() i.Type = "range" i.Min = strconv.FormatFloat(min, 'f', -1, 64) i.Max = strconv.FormatFloat(max, 'f', -1, 64) i.Value = strconv.FormatFloat(value, 'f', -1, 64) if step != step { i.Step = "all" } else { i.Step = strconv.FormatFloat(min, 'f', -1, 64) } if id != "" { i.SetID(id) } return i }
// InputSubmit creates a submit input func InputSubmit(name string) *dom.HTMLInputElement { i := xdom.Input() i.Type = "submit" i.Value = name return i }