• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Javascript: changes are not updated

mariluzrm

Member
Hello.

In a dropdown element of a repeat group I am including javascrip code to hide / show other elements of the same group. I have first included code in the "load event" and it works, but in the "change event" it doesn't work (I can't even see it with the browser debugger). Why doesn't it work at the "event change"?

The code is:

var sel = this.getValue();
var repeat = this.getRepeatNum();

var field1 = this.form.formElements.get('componte___MACIZOEX_'+repeat);
var field2 = this.form.formElements.get('componte___CAR_TIR_'+repeat);
var field3 = this.form.formElements.get('componte___NLINCENT_'+repeat);
var field4 = this.form.formElements.get('componte___NLINDCHO_'+repeat);
var field5 = this.form.formElements.get('componte___NLINIZQ_'+repeat);
var field6 = this.form.formElements.get('componte___NCABCENT_'+repeat);
var field7 = this.form.formElements.get('componte___NCABDCHO_'+repeat);
var field8 = this.form.formElements.get('componte___NCABIZQ_'+repeat);
var field9 = this.form.formElements.get('componte___TIPOHAST_'+repeat);
var field10 = this.form.formElements.get('componte___LUZ_'+repeat);
var field11 = this.form.formElements.get('componte___CANTOMAX_'+repeat);
var field12 = this.form.formElements.get('componte___CANTOMIN_'+repeat);


if (sel!=="1" && sel!=="0"){
field10.hide();
field11.hide();
field12.hide();
}

if (sel!=="5" && sel!=="0"){
field1.hide();
field2.hide();
field3.hide();
field4.hide();
field5.hide();
field6.hide();
field7.hide();
field8.hide();
}

if (sel!=="8" && sel!=="0"){
field9.hide();
}


Also, on some occasions, I change javascript code and it does not update it (I do not see it updated in the browser debugger either). I have tried to clear the browsing history in Chrome and sometimes it updates and sometimes not. Why?

Thanks!!!
 
Did you clear all Joomla and browser cache after JS modifications? Browser with hard relead (in Chrome only possible if the dev console is open).
Did you exclude Fabrik from 3rd party JS and CSS compression (if you have some)?
During development you can enable "Burst JS" in Fabrik Options/Debugging to force automatic JS reload
 
There's a very simple, but effective way to check if the changes in your code are being reflected and not the cached version loaded instead.

Just add something like console.log("1"); in your code and every time you make a change, increase the number by 1.

And of course you can "console.log" your variables in your change event code to see that they are what they should be.

If you don't see anything in the browser console, Troester's tips will probably help.
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top