• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

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) {
 .....
});
 

Members online

No members online now.
Back
Top