• 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.

Repeat Num Element option in Groups

Bauer

Well-Known Member
I'm back into trying to use joined tables and repeat groups again.

In the Group configuration, I haven't a clue what this 'Repeat Num Element' option is about and can't find any info on it. There's not even a tooltip.
Can someone update the Wiki?
 
Ooops, I had the description tag wrong, it was set to _LABEL instead of _DESC. Fixed in github. And as per the (now displaying) tooltip:

Optional - you can choose an element which will be used to specify the number of repeats for this group. When the value is changed, the form will automatically add/remove groups to the specified number. The element your choose cannot be in a repeat group!

So, say you have a form with a repeat group for "Child Details". Normally the new form loads, and a static X number of repeats are shown (depending on what you set for "Repeat Min"). What "Repeat Num Element" does is, you could have (say) a dropdown in the main group for "Number of Children". If you designate that as the "repeat num element", when the user selects 5, we add/remove repeats so there are 5 showing.

This is a fairy new feature I added for one of our clients. I can't recall if I finished off what I'd intended to do, which is to hide the +/- buttons if that feature is used. I think we wound up hiding those in CSS. My intent was to automatically hide them, so the number of repeats is entirely controlled by the "num" element.

Feel free to update the wiki once you get your head round the feature.

-- hugh
 
That's a great function! But for me it doesn't work : I did a field where the number of checkboxes selected is written. I set this field in the group options 'Repeat Num Element'. When I change the number, nothing happens....
 
The website is confidential, so I can't post here on public forum the logins for the website. I have found a hack : create a list from the repeat table and make a cascadingdropdown on it. So it works.
 
Here's my code for duplicate groups : I put it in a .js file called "form_10.js". It doesn't work. Could you tell me why? Thanks.

JavaScript:
// JavaScript Document
requirejs(['fab/fabrik'], function() {
    window.addEvent('domready', function() {
        // your code
        // Your form reference
        var formRef = 'form_10';

        // The group you wish to repeat's ID
        var groupId = 69;

        // The number of times to repeat

        var repeatNum = 3;
        var form = Fabrik.blocks[formRef];

        // Get the repeat group button
        var btn = form.getElement('#group' + groupId + ' .addGroup');
        if (typeOf(btn) !== 'null') {

            // Create mock event
            var e = new Event.Mock(btn, 'click');

            // Duplicate group
            for (var i = 1; i < repeatNum; i++) {
                form.duplicateGroup(e);
            }
        }




    });

});
My form id = 10, my group id = 69.
Also, I want the text field "data_signs___selected_checkboxes" (in which the number of selected checkboxes is shown) be the var repeatNum. I tryed to access to it, but ... Nothing tore than with the code above these lines.
Thank you for the help.!!!!!
 
I didn'u used the built-il feature, because the number of repeat on my form is dynamically calculated by javascript.
The url of the form is : /index.php?option=com_fabrik&view=form&Itemid=117&formid=10&rowid=7&listid=10
 
If you are calculating it on the fly in JS, you could still use the built in feature, you'd just have to trigger the repeat count element's change event after updating it.

So to update it to 3 ...

Code:
var el = Fabrik.getBlock('form_X').formElements.get('yourtable___repeatcount');
el.update('3');
el.element.fireEvent(el.getChangeEvent(), new Event.Mock(el.element, el.getChangeEvent()));

-- hugh
 
Thank you, but I don't unserstand your code : I want to automatically dupolicate group 69 on update odf the field 'data_signs___selected_checkboxes' (this field calulates automatically via javascript the number of checked options on another field).
fireEvent is it for the button "add" on my form to duplicate it?

Thank you!
 
I just want to detect the number of repeat fields in my field 'data_signs___selected_checkboxes' and duplicate the group according to this value. Actually, my code works only on modify.
Code:
requirejs(['fab/fabrik'], function() {
   
   Fabrik.addEvent('fabrik.form.group.duplicate.min', function(form) {
      form.options.minRepeat[69] = form.options.maxRepeat[69] = form.formElements.get('data_signs___selected_checkboxes').getValue().toInt();
   });
});
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top