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

SOLVED Hide/show elements in repeatable groups

Hi!

I've got pretty complex form with 9 various repeatable groups. Some include many elements and I'd like to show/hide some of them depending on value of other elements in those groups. Yes, I can click that all the way in 'Javascript' section (and it works), but then I have even nearly 50 conditions (load, click, clear for each depending element). I thought I could use custom code field to group these conditions and make it easier to manage, however in case of repeatable groups this solution:

http://fabrikar.com/forums/index.php?threads/hide-show-elements-using-custom-javascript.38741/

doesn't work. Is there any easy way to 'convert' above solution to repeatable groups' needs, or the matter is too complex and better stick to clicking those Javascript rules?

Cheers,

Olek
 
I've tried that, but the main problem is: I still cannot address the element in all repetitions of the group. All I can do is manually address 'table___element_0', 'table___element_1' and so on. I can't just use 'table___element' in JS - the form doesn't see it. But like I said - when I create the rules clicking them out in Javascript section of element settings, they just work (probably thanks to a ton of behind-the-scenes coding). I was just curious if I can avoid creating tens and tens of 'clicked' JS rules for my elements in repeating groups.

Thanks anyway.
 
You can use element.getRepeatNum(), but I'm doing a lot of element manipulation in form_XX.js with jQuery. For example you can address element by part of it's id. E.g. repeat elements with the following id-s:
mytable___repeat-element_0
mytable___repeat-element_1

can be addressed with:
input[id^='mytable___repeat-element']

So you could do:
jQuery('input[id^="mytable___repeat-element"]').addClass("hide-element");
or
jQuery('input[id^="mytable___repeat-element"]').hide();
etc.
 
Last edited:
juuser, you're my hero. THANK YOU! I'm too blonde to play with jQuery, but element.getRepeatNum() was my life saver. Mission accomplished!
 
Excellent! And if element.getRepeatNum() was a lifesaver, you can definitely manage jQuery :)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top