tcomb-form
tcomb-form copied to clipboard
Multiple files upload
I need to setup a form to post multiple files. I followed instruction from #112 and it is working well for one File
.
Version
- tcomb-form v0.9.10
- react v15.3.1
Expected behaviour
Should get a list of files.
Actual behaviour
I am getting null
.
Steps to reproduce
So, here is my type
const Uploads = t.struct({
files: t.list(t.form.File)
})
Because, I still want to use the html input and not an array, my options are
const options = {
label: 'Step 2. Uploads',
fields: {
files: {
factory: t.form.Textbox,
type: 'file',
attrs: {
multiple: true,
},
help: 'Add a photo to help tell your story.',
}
}
}
Everything is fine until I call getValue
on the form, I get null
.
It returns a File
with the type below.
const Uploads = t.struct({
files: t.form.File
})
Any way to get an array of files? For input[type="file"]
the onChange
only send the first file and the list is available at input.files
.
Thanks for your awesome tool!
Probably the source of my issue: https://github.com/gcanti/tcomb-form-templates-semantic/blob/master/src/textbox.js#L27