Solved Display repeat groups in form when Repeat Min is set to zero

ghicar

Member
I am not sure if this is a Fabrik issue or a template issue. The scenario is that you have a joined table with the repeat group set to display in a form as "list" and "repeat min" set to zero. When you click the add button in a list view to load the form, as expected, the form initially shows with "no data" for the repeat group. However when you click the green add group button, it adds a group but it does not display the elements when using the template we use t4-bs5-blank. If you switch the repeat group to be a table layout then the elements are displayed correctly.
If you switch to the default Cassiopeia template then it works correctly in both list and table view modes.

I found a workaround in ./media/com_fabrik/js/form.js in the duplicateGroup function around line 2428 I added an extra last line shown below as the show() didn't seem to be changing the element's display style when using t4-bs5-blank:

Code:
                } else {
                    subgroups[0].getElement('.fabrikNotice').dispose();
                    subgroups[0].getElement('.fabrikSubGroupElements').show();
                    subgroups[0].getElement('.fabrikSubGroupElements').setStyle('display', 'block');

TBH, I am not sure where to look to see why it works ok in Cassiopeia but not in t4-bs5-blank.
Note also that code change above had to be applied to the minimised form.js located in ./media/com_fabrik/js/dist.

I have backed out this change as I suspect it is the t4-bs5-blank template that is at fault, and I have switched to using table view for now.

Fabrik 4.3
Joomla 5.2.0
PHP 8.2.24
 
Last edited:
This seems to be a mootoools thing :(. I have to confess not really sure what I am doing here but I tracked this issue down to the t4-bs5-blank template, or rather the T4 framework (Joomlart) on which it sits which has a JS file: ~/plugins/system/t4/themes/base/js/base.js that had some code:

Code:
// Add missing Mootools when Bootstrap is loaded
(function($)
{
    $(document).ready(function(){
        var bootstrapLoaded = (typeof $().carousel == 'function');
        var mootoolsLoaded = (typeof MooTools != 'undefined');

        if (bootstrapLoaded && mootoolsLoaded ) {
            Element.implement({
                hide: function () {
                    return this;
                },
                show: function (v) {
                    return this;
                },
                slide: function (v) {
                    return this;
                }
            });
        }
    });

Which were replacing Element hide(), show(), slide() functions defined in ~/media/com_fabrik/js/dist/mootools-more.js with some empty ones.

Changing the above code to:

Code:
// Add missing Mootools when Bootstrap is loaded if not already defined
(function($)
{
    $(document).ready(function(){
        var bootstrapLoaded = (typeof $().carousel == 'function');
        var mootoolsLoaded = (typeof MooTools != 'undefined');
        var mootoolsShowDefined = (typeof Element.show === "function");

        if (bootstrapLoaded && mootoolsLoaded && !mootoolsShowDefined) {
            Element.implement({
                hide: function () {
                    return this;
                },
                show: function (v) {
                    return this;
                },
                slide: function (v) {
                    return this;
                }
            });
        }
    });

Fixed the displaying problem I was suffering from.
 
Mootools is not longer coming with J! (since J!4), so is this template for J!4+ at all?

We moved the (modified) mootools files under the fabrik folder because Fabrik still needs it (hopefully can be removed in F5).

So yes, obvioulsy some incompatibility.
 
Back
Top