With this given HTML code I was able to add a simple javascript function to verify that at least one checkbox is checked.
Now it turns out that I only receive the value of the first checked checkbox, even when all three are checked.
HTML:
<label class="foo">
<input type="checkbox" name="bar[]" value="W01">
<span class="label-body">Apple</span>
</label>
<label class="foo">
<input type="checkbox" name="bar[]" value="W02">
<span class="label-body">Banana</span>
</label>
<label class="foo">
<input type="checkbox" name="bar[]" value="W03">
<span class="label-body">Melon</span>
</label>
Controller:
func (this *SendController) Post() {
beego.Info(this.GetString("bar[]"))
// ...
}
How can I get the list of all selected checkboxes, ie. W01 & W03?
Bonus question:
What is the difference between this.GetString("foo")
and this.Input().Get("foo")
?