@@ -255,17 +255,17 @@ This category includes checkbox, select and radio button fields.
255
255
Checkbox field requires a name and a set of options to populate the field. The options are just a set of InputChoice (Id-Value pairs) objects:
256
256
257
257
opts := []fields.InputChoice{
258
- fields.InputChoice{"A", "Option A"},
259
- fields.InputChoice{"B", "Option B"},
258
+ fields.InputChoice{Id: "A", Val: "Option A"},
259
+ fields.InputChoice{Id: "B", Val: "Option B"},
260
260
}
261
261
f := fields.CheckboxField("checkbox", opts)
262
262
f.AddSelected("A", "B")
263
263
264
264
Radio buttons, instead, require a name and a set of options to populate the field. The options are just a set of InputChoice (Id-Value pairs) objects:
265
265
266
266
opts := []fields.InputChoice{
267
- fields.InputChoice{"A", "Option A"},
268
- fields.InputChoice{"B", "Option B"},
267
+ fields.InputChoice{Id: "A", Val: "Option A"},
268
+ fields.InputChoice{Id: "B", Val: "Option B"},
269
269
}
270
270
f := fields.RadioField("radio", opts)
271
271
@@ -274,8 +274,8 @@ Select fields, on the other hand, allow option grouping. This can be achieved by
274
274
opts := map[string][]fields.InputChoice{
275
275
"": []fields.InputChoice{fields.InputChoice{"A", "Option A"}},
276
276
"group1": []fields.InputChoice{
277
- fields.InputChoice{"B", "Option B"},
278
- fields.InputChoice{"C", "Option C"},
277
+ fields.InputChoice{Id: "B", Val: "Option B"},
278
+ fields.InputChoice{Id: "C", Val: "Option C"},
279
279
}
280
280
}
281
281
f := fields.SelectField("select", opts)
0 commit comments