Cannot save more than 1 event in element's JS tab

Trembowiecki

Active Member
Hi,

I'm forced to start a new project, so I've decided to give Fabrik 4 a try. I use Joomla 5.0.1, Fabrik 4.0 Zeta and PHP 8.1.x/8.2.x (tried both).

Whenever I add more than 1 JS event in element JS tab, the element saves only the 1st one and the browser console shows errors ('Uncaught TypeError: Cannot convert undefined or null to object').

And when I try to remove JS events completely, it's even worse - I can't save changes to the element (console: 'Uncaught TypeError: Cannot read properties of undefined (reading 'canSaveForm')').
 
Fabrik 4 is not really tested on J!5.

But I just tried and I didn't see an issue while adding 2 JS events, no console errors, adding and deleting JS events is working.

Which element plugin?
What are your exact JS settings?
All fields correctly filled?
 
I confirm, no issues in J4. My J5 installation is clean, I use Cassiopeia template. I've tried to add more than 1 event to radiobutton element. I don't 'click out' JS rules, I only choose event from dropdown and type in 'Javascript code' field. When I save the element, I can see in database 2 created JS events, so all good. But when I open the element in Fabrik again and click on JavaScript tab, I can see only first event. When I click 'Save', instead of 'Cancel', the second event is deleted from database. I use Fabrik for years and my JS code works in Fabrik 3, so it's not the code, I guess. The above mentioned error ('Uncaught TypeError: Cannot convert undefined or null to object') appears in browser console the very second I click 'Add' in Javascript tab, so maybe it's the culprit?...

The fact that you cannot reproduce it is really frustrating, as I really have clean install (Joomla 5.0.1 + Fabrik 4.0 Zeta) with no additional extensions.
 
I didn't try the JS code field, only with two events with build-in functions, these were working.
Will try later.
 
I tested 2 JS events with a simple confirm('...'); in the code field.
It's working also. Save, reopen, edit the confirm texts, save again, test in the frontend - all ok.

It seems if radio is set to button group the JS is run twice (I get confirm1,confirm2,confirm1,confirm2 in this case), but this is an other issue.
 
I really don't know what's going on. I hope somebody bumps into the same problem, so it won't be only me. Anyway - thank you for checking. Guess that means I'm bound to Joomla 4.x.
 
Is this independend of the code you add?
What happens with a new element and e.g. only "confirm"?

BTW: the element JS events are stored in #_fabrik_jsactions, so if something got screwed up on your site you may delete them there.
 
This whole situation is totally messed up. Here's what I do: I have my own servers, so I install them and configure on my own. Having the environment ready, I unzip Joomla package and send it to the server via FTP. Then I install Joomla and the first thing after is installing Fabrik. So in the first 2 tries the JS tab generated error after error in console right away. Then I deleted all the files and database and decided to give it a 3rd try. And guess what - it works without errors this time. It's so strange, because I've changed literally nothing. I'm going to add some data and then will check if these errors occur, so I can narrow the moment when they kick in (if they will at all). I'll let you know when there's a trace of what might have happened.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top