-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onclick method working only locally #13
Comments
I have no free time to help for you now. But I think that you go right way, problem is in onclick event. |
I ended up with something like this in the form: <?php
$this->registerJs("
var formbutton = $('#formsubmit');
formbutton.on('click', function(e) {
$('#formsubmit').prop('disabled', true);
e.preventDefault();
$('#file-input').fileinput('upload');
});
$('#file-input').on('filebatchuploadcomplete', function(event, files, extra) {
document.mioform.submit();
});
"); Being |
Fixed just now, please update and check how does it work |
working great, thanks! |
Error check is not perfect... For example if the uploaded files are bigger than max_post_size or max_upload_size an error is displayed in the widget, but the form is submitted anyway |
Fixed on f45842c, please test it |
I was trying the suggested method to upload files on form submit but it doesn't seem to work. At least it does not on production server.
When I submit a form locally, even with a rather large file (5MB), the upload is very fast so it completes within milliseconds, even before the form submit.
When I do the same on the production server, which is much slower in bandwidth, the file upload starts but the form is submitted at the same time, so when the file send reaches say 5% the page is changed and upload interrupted.
The upload should probably be handled by returning false to the
submit
, and attach to file-input'sfilebatchuploadcomplete
event in order to finally submit the form.I tried this solution:
But it won't work anyway. The upload seems to complete but it's not attached to the model. More details on the forum
The text was updated successfully, but these errors were encountered: