Element JS :: Predefined actions and custom code not working :: Bug?

Status
Not open for further replies.
Dear Members,
I am trying to create 2 separate JS events on a single element.
First JS event is on 'click/change' using custom JS code... And the second is on 'load' using predefined actions. Somehow these two don't work together.
In my testing I am able to trigger the JS only if both are JS custom code(s) or both are predefined actions.
Is it a bug?
 
Working for me in several cases with a Github update from about a month ago. How does your custom code look like?

Do you see any errors in browser console?
 
Hi @juuser... Just to add that I am having this issues with custom JS code in form_X.js and even with custom JS code entered in the admin backend.
Custom code is details_x.js is:

JavaScript:
/**
* Ensure that Fabrik's loaded
* Source: http://fabrikar.com/forums/index.php?wiki/javascript/
*/

requirejs(['fab/fabrik'], function (Fabrik) {

  // The block you want to use
  var blockRef = 'form_2';

  // Should we use an exact match for the blockRef?
  var exact = true;

  var form = Fabrik.getBlock(blockRef, exact, function (block) {

    // This callback function is run once the block has been loaded.
    // The variable 'block' refers to Fabirk.blocks object that controls the form.
    var target = block.elements.get('table_name__element_name');
      element.hide();
  });
});

And, I have change events on the same element which don't trigger if the above code is enabled.
No errors on browser.
 
OK, I didn't realize you have a javascript form file in use.

But shouldn't the line "element.hide()" be "target.hide()" instead?

Of course that probably doesn't explain why your predefined javascript actions do not trigger.

What happens if you remove all the code from the js-file (just leave requirejs...) and add console.log("test"); ? Does it work then and do you see the word "test" in the browser console?
 
Hi @juuser... You are absolutely right. It was a copy/paste mistake!
Anyways, somehow while playing around with the settings, it started to work as expected. Haven't changed anything significant. Am surprised!
Thanks for your response and support. Appreciated! :)
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top