iris icon indicating copy to clipboard operation
iris copied to clipboard

ReadForm error with nested struct array

Open WingGao opened this issue 9 years ago • 1 comments

Request:

# post form
Items[0].Value=1&Items[1].Value=1

Server:

type S1 struct {
    Items []S2
}
type S2 struct {
    Value string
}

...
obj := &S1{}
err := ctx.ReadForm(obj) //while trying to read formam: not supported type for field "Value" in path "Items[1].Value"
...

work fine with github.com/go-playground/form

WingGao avatar Sep 13 '17 08:09 WingGao

@WingGao ctx.ReadForm and formam works with nested fields, just use the .(dot).

An example can be found at its official docs: https://github.com/monoculum/formam#in-form-html

hiveminded avatar Sep 13 '17 08:09 hiveminded