How to parse html form array with Beego.
<input name="names[]" type="text" />
<input name="names[]" type="text" />
<input name="names[]" type="text" />
Go Beego
type Rsvp struct {
Id int `form:"-"`
Names []string `form:"names[]"`
}
rsvp := Rsvp{}
if err := this.ParseForm(&rsvp); err != nil {
//handle error
}
input := this.Input()
fmt.Printf("%+v
", input) // map[names[]:[name1 name2 name3]]
fmt.Printf("%+v
", rsvp) // {Names:[]}
Why Beego ParseForm method return an empty names?
How to get values into rsvp.Names?