mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-08-07 15:30:44 +02:00
Restore file inputs functionality. Process the form via javascript only if no file inputs are found.
The file inputs are not found in Pages, so in that case, the JS form processing still kicks in as usual. In plugins and themes blueprints on the other hand, if there is a file input we avoid JS processing, since we also do not actually need this part of code in those forms.
This commit is contained in:
@@ -171,9 +171,12 @@
|
||||
this.form = $(el);
|
||||
this.form.data('grav-form-instance', this);
|
||||
this.form.on('submit', function (e) {
|
||||
this.submit(this.ajax);
|
||||
e.preventDefault();
|
||||
return false;
|
||||
if (Form.findElements(this.form, 'input[type="file"]', '', false).length == 0) {
|
||||
//Only process the form if it does not contain file elements, otherwise we cannot get $_FILES correctly
|
||||
this.submit(this.ajax);
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
this.scanned = false;
|
||||
|
||||
Reference in New Issue
Block a user