johnonorvic
Member
I have a form with several groups which are shown or hidden by JS triggered by button clicks. Once a group is shown, calling hide() for it does nothing. The debugger shows the group’s attributes[2] property to be style="display: block;" when shown and style=";display:none;" when hidden. A call to show() changes it to "display: block;", but a call to hide() has no effect.
Digging deeper, hide() makes a call to /media/com_fabrik/js/mootools-ext-js, line 137, where the code is:
If the hide() call has no parameter and the bootstrap version is higher than 2 (it is actually 5.1.3), no mHide.apply() call to change the visibility is made. In contrast, the code for the show() call is:
which lacks the two tests and so works.
The site is converted from Fabrik3 and hide() had worked there, so I had a look at that. The code in mootools-ext-js is simpler, but the “Fabrik.bootstrapVersion('modal') >= 3” test is the same. In Fabrik4, the code to get the version is in /media/com_fabrik/js/fabrik.js at line 33 and returns 5.1.3 from pluginFn.Constructor.VERSION. In the Fabrik3 system, both pluginFn.VERSION and pluginFn.Constructor.VERSION are undefined, so the function returns the default of “2”, which passes the test in the hide function.
I do not know why hide() has the extra tests that show() lacks; presumably there was a reason they were included. It seems to me it either needs to be updated or removed. There are two ways I can get it to work, either by adding a random number as a parameter of the hide() call or modifying the test in mootools-ext-js to:
Digging deeper, hide() makes a call to /media/com_fabrik/js/mootools-ext-js, line 137, where the code is:
JavaScript:
hide: function (ha) {
if (ha === undefined) {
if (this.parentNode.dataset.modalContent === undefined
&& this.dataset.modalContent === undefined
&& Fabrik.bootstrapVersion('modal') >= 3) {
return;
}
if (this.hasClass('mootools-noconflict')) {
return this;
}
}
mHide.apply(this, arguments);
},
JavaScript:
show: function (v) {
if (this.hasClass('mootools-noconflict')) {
return this;
}
mShow.apply(this, v);
},
The site is converted from Fabrik3 and hide() had worked there, so I had a look at that. The code in mootools-ext-js is simpler, but the “Fabrik.bootstrapVersion('modal') >= 3” test is the same. In Fabrik4, the code to get the version is in /media/com_fabrik/js/fabrik.js at line 33 and returns 5.1.3 from pluginFn.Constructor.VERSION. In the Fabrik3 system, both pluginFn.VERSION and pluginFn.Constructor.VERSION are undefined, so the function returns the default of “2”, which passes the test in the hide function.
I do not know why hide() has the extra tests that show() lacks; presumably there was a reason they were included. It seems to me it either needs to be updated or removed. There are two ways I can get it to work, either by adding a random number as a parameter of the hide() call or modifying the test in mootools-ext-js to:
Fabrik.bootstrapVersion('modal') >= 6
but do not know what ought to be done.