From 08f222d7079bc70aba4e2f248fd3978a8cda6087 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 17 Oct 2014 15:29:00 +0200 Subject: [PATCH] [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. --- addons/website/static/src/js/website.editor.js | 10 ++++++++-- 1 file 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',