I am pretty much new with this, so I need a little bit of help.
I have two structs like this:
type School struct {
ID string
Name string
Students []Student
}
type Student struct {
ID string
Name string
}
What I need to do is when I select one School object from first select element, that second select element displays only Students from selected School. Array of object School displays all data correctly.
<div> <select name="school"> {{range .Schools}} <option value="{{.ID}}">{{.Name}}</option> {{end}} </select> </div> <div> <select name="student"> {{range .Students}} <option value="{{.ID}"> {{.Name}}</option> </select> {{end}} </div>
I need to range in second select something like selectedSchoolObject.Students.
Thanks in advance!