summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2014-10-17 15:29:00 +0200
committerDenis Ledoux <dle@odoo.com>2014-10-17 15:29:00 +0200
commit08f222d7079bc70aba4e2f248fd3978a8cda6087 (patch)
tree3fb1d2e84765da3aa874a10a1cf65d605183cdea
parentba272ad69ae6745e91a42e4b5c9cbc7dc4fc1b0a (diff)
[FIX] website: use dom element instead of jquery class to click input file
For some reasons, the browser will prevent to open the system file browser when clicking the input file with javascript using the jquery class element, but it works when using the standard js dom element.
-rw-r--r--addons/website/static/src/js/website.editor.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 2764e2138ee..a339ea6d63a 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -1379,11 +1379,17 @@
this.changed($(e.target));
},
'click button.filepicker': function () {
- this.$('input[type=file]').click();
+ var filepicker = this.$('input[type=file]');
+ if (!_.isEmpty(filepicker)){
+ filepicker[0].click();
+ }
},
'click .js_disable_optimization': function () {
this.$('input[name="disable_optimization"]').val('1');
- this.$('button.filepicker').click();
+ var filepicker = this.$('button.filepicker');
+ if (!_.isEmpty(filepicker)){
+ filepicker[0].click();
+ }
},
'change input[type=file]': 'file_selection',
'submit form': 'form_submit',