Open rhaamo opened 7 years ago
I tried another way with:
type Item struct {
Description string `binding:"MaxSize(255)"`
IsPublic bool `binding:"Default:1"`
FilesFilename []string `binding:"Required;MaxSize(255);MinSizeSlice(1)"`
FilesContent []string `binding:"Required;MaxSize(255);MinSizeSlice(1)"`
}
If I set Description
to Required
, submitting a form with empty fields threw an error (expected).
If I leave the struct as-is (no Required for Description, only Files Contents and names), and submit form with files_*
empty, it threw no errors. (it should)
I found issue #3 but it does seems to only apply to JSON format parser.
Is there any way to do Validation on slices items builtin in macaron/binding or do I need to make them myself after the non-slice fields validation ?
Hi, I pushed a patch to fix Required check for slice, please help test!
It seems that the JSON part supports having multiple "sub-forms" (slices of structs ?).
I would like to have something like (not File Uploads here, plain HTML input forms):
Is it possible to do that ? how should I use the "ItemFile" and naming in html for fields names ?