-
Notifications
You must be signed in to change notification settings - Fork 0
/
htmlInputRadio.go
86 lines (73 loc) · 3.78 KB
/
htmlInputRadio.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package telerik
import (
"bytes"
"reflect"
)
// <input> elements of type radio are generally used in radio groups—collections of radio buttons describing a set of
// related options. Only one radio button in a given group can be selected at the same time. Radio buttons are typically
// rendered as small circles, which are filled or highlighted when selected.
//
// <input type="radio" id="radioButton">
type HtmlInputRadio struct {
/*
The name of the control, which is submitted with the form data.
@see typeNamesForAutocomplete.go
Ex.: const NAMES_FOR_AUTOCOMPLETE_NAME
*/
Name string `htmlAttr:"name" jsonSchema_description:"" jsonSchema_enum:"['name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'email', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'url', 'photo']"`
/*
The initial value of the control. This attribute is optional except when the value of the type attribute is radio or
checkbox.
Note that when reloading the page, Gecko and IE will ignore the value specified in the HTML source, if the value was
changed before the reload.
*/
Value string `htmlAttr:"value"`
/*
The form element that the input element is associated with (its form owner). The value of the attribute must be an id
of a <form> element in the same document. If this attribute is not specified, this <input> element must be a
descendant of a <form> element. This attribute enables you to place <input> elements anywhere within a document, not
just as descendants of their form elements. An input can only be associated with one form.
*/
Form string `htmlAttr:"form"`
/*
This Boolean attribute indicates that the form control is not available for interaction. In particular, the click
event will not be dispatched on disabled controls. Also, a disabled control's value isn't submitted with the form.
Unlike other browsers, Firefox will by default persist the dynamic disabled state of an <input> across page loads. Use
the autocomplete attribute to control this feature.
*/
Disabled Boolean `htmlAttrSet:"disabled"`
/*
When the value of the type attribute is radio or checkbox, the presence of this Boolean attribute indicates that the
control is selected by default, otherwise it is ignored.
Unlike other browsers, Firefox will by default persist the dynamic checked state of an <input> across page loads. Use
the autocomplete attribute to control this feature.
*/
Checked Boolean `htmlAttrSet:"checked"`
Global HtmlGlobalAttributes `htmlAttr:"-"`
*ToJavaScriptConverter `htmlAttr:"-"`
}
func (el *HtmlInputRadio) ToHtml() []byte {
var buffer bytes.Buffer
if el.Global.DoNotUseThisFieldOmitHtml == TRUE {
return []byte{}
}
element := reflect.ValueOf(el).Elem()
data := el.ToJavaScriptConverter.ToTelerikHtml(element)
buffer.Write([]byte(`<input type="radio"`))
buffer.Write(el.Global.ToHtml())
buffer.Write(data)
buffer.Write([]byte(`>`))
return buffer.Bytes()
}
func (el *HtmlInputRadio) GetId() []byte {
if el.Global.Id == "" {
el.Global.Id = GetAutoId()
}
return []byte(el.Global.Id)
}
func (el *HtmlInputRadio) GetName() []byte {
if el.Name == "" {
el.Name = GetAutoId()
}
return []byte(el.Name)
}