Popup js conflict

teoyh

Member
Javascript_conflict.JPG Please refer to the attachment above. The main form is 474 and on top of the form is a list of applicant. When the user click on the add applicants, a form will popup to allow user to add the applicant. Now when he click on the save button the weird thing happen is that instead of executing form_476.js it actually executed form_474.js as i can see the Submit change to saving.
I set the Ajaxify links to yes so that the user do not need to go in and out of the form. But when the form_476 is in a popup the validation and the js conflict will come in.

Anybody experience this before ?
 
What code do you have in form_476 and form_474.js? I presume you are referring to custom JS files in ./components/com_fabrik/js?

If you are using Fabrik events, like fabrik.form.submit.start or fabrik.form.submit.end, etc. then you need to check in your code which form ID the event has been fired for. For example ...

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.form.submit.start', function (form, event, btn) {
      if (form.id == 476) {
         // do your stuff here
      }
   });
});
[code]

   -- hugh
 
What code do you have in form_476 and form_474.js? I presume you are referring to custom JS files in ./components/com_fabrik/js?

If you are using Fabrik events, like fabrik.form.submit.start or fabrik.form.submit.end, etc. then you need to check in your code which form ID the event has been fired for. For example ...

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.form.submit.start', function (form, event, btn) {
      if (form.id == 476) {
         // do your stuff here
      }
   });
});
[code]

   -- hugh
So it does not specifically refer to the JS file id ? I have to check the form.id in the js file is that correct.
 
So it does not specifically refer to the JS file id ? I have to check the form.id in the js file is that correct.

Yes. Adding an event listener just listens for that event firing. It's up to you, if you have more than one form (or list, or whatever the event is generated by) on the page to check which ID it was fired by.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top