Form events are still available?

mirceat

Member
Hello,

I want to run an event every time the form is submiting data but I can't make it work, nothing happen, not even the alert. I created form_1.js in components/com_fabrik/js folder and added your example. Tested also on load.

Code:
Fabrik.addEvent('fabrik.form.submit.start', function(form, event, button) {

    alert('aha! you really should not press that button');

    form.result = false;

})

My code is this, works fine in Fabrik 3 but not in Fabrik 4:

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

Fabrik.addEvent('fabrik.form.submit.end', function (form) {

  // Replace 6 with the repeat group's id
  var groupId = 6;

  // Get the number of times the group has been repeated
  var repeatMax = form.repeatGroupMarkers[groupId];

  // Get the newly added element
  for (var i = 0; i < repeatMax;i++){
  var el = form.formElements['contracts_tool_setari_6_repeat___pozitie_camp_' + i];
  var el_value = el.get('value');
  if (!el_value){
  el.update(i);
  }
  }
 
});

});

Php 8, Joomla 5.0.2, Fabrik 4
 
Try wrapping it with

Code:
document.addEventListener("DOMContentLoaded", function(event) {
 .....
});
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top