HubSpot / vex

A modern dialog library which is highly configurable and easy to style. #hubspot-open-source
http://github.hubspot.com/vex/docs/welcome
MIT License
6.92k stars 491 forks source link

file input inside vex.open() #278

Open tristanthar opened 5 years ago

tristanthar commented 5 years ago

I'm trying to implement a file upload functionality with vex.

This is my code (taken from the documentation): vex.dialog.open({ message: 'Select your document', input: [ '<div class="ed-modal-input-field-wrapper">', '<label for="ed_doc">Document</label>', '<div class="ed-modal-input-wrapper">', '<input name="ed_doc" id="ed_doc" type="file" />', '</div>', '<p><small>Accepted file formats: .docx, .doc and .otf</small></p>', '</div>' ].join(''), callback: function(data) { if (!data) { return console.log('Cancelled') } console.log('File', data.ed_doc) console.log(data); } });

However this always returns "undefined" in the callback function.

Are file inputs something that can be done with Vex?

codebru commented 5 years ago

I am also having this issue and am interested in whether it is possible.