Bug #22018 Bug Fixed

FilePicker callback methods stacking and being run when they shouldn’t

Version: 3.4.1 Reporter: TJ Draper

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

Sorry, don’t know of a better way to describe this problem. Essentially, if I click a button in my add-on that triggers a filepicker, it works fine the first time, passing the file to my specified method. However, if I click another button that calls the file picker, it runs the callback function for both buttons. If I click a third button, it runs the callback function on all three, and so on. So once a button has been clicked, the file picker will run the callback method on any filepicker button that has been previously clicked. This, as you might imagine, is causing me a fair amount of grief.

Here is the code where I add the callback method:

 callback: function(file, references) {
  // Close the modal

  // Set the file
  _this.file = file;

  // Set the button that initialized call to an object variable
  _this.$addBtn = $addBtn;

  // Show loading animation

  // Run image capture

I’ve narrowed this down to something that changed between 3.3.4 and 3.4.1 since it does not happen on 3.3.4 but it does on 3.4.1 (sorry, didn’t catch it on 3.4.0 but that’s probably where this bug was introduced).

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases