I think this schema package is very cool; something that is so
necessary I was about to build myself until I found this project.
Thanks for the work!!
Just wanted to let you know, I don't think the "Phones" slice example
works I created some test code and it never populates the slice with
any information. Here is the sample code did I miss something or is
this a bug?:
package main
import (
"
gorilla.googlecode.com/hg/gorilla/schema"
"http"
"fmt"
)
type Phone struct {
Label string
Number string
}
type Person struct {
Name string
Phones []Phone
}
func handler(w http.ResponseWriter, r *http.Request) {
r.FormValue("") // forces the form parser
person := &Person{}
err := schema.Load(person, r.Form)
if err != nil {
panic(err)
}
fmt.Printf("%s", person)
fmt.Printf("Number of phones : %d\n", len(person.Phones))
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8888", nil)
}