Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi, i´m asking a lot lately, this time i´m trying to create an option in admin that will repeat a repeatable region as many times as one opt_value was selected in another repeatable region:

The first repeatable region display a set of options, lets name them "1" and "2", what i want is that if the option 1 is selected lets say 3 times then 3 new repeatable regions with another set of options are available in the admin, I ended up with the following code:

Code: Select all
<cms:repeatable name="elements">
  <cms:editable name="element"
                type="dropdown"
                opt_values="1|2"
  />
</cms:repeatable>

<cms:show_repeatable "elements">
  <cms:if element="1">
    <cms:repeatable name="options_1_<cms:show k_count/>">
      <cms:editable name="option"
                    type="dropdown"
                    opt_values="Option 1 | Option 2 | Option 3"
      />
    </cms:repeatable>
  </cms:if>
</cms:show_repeatable>


This shows like this in the admin:

repeat.png
repeat.png (26.94 KiB) Viewed 1809 times


The first option looks and works fine but the next two (options_1_3 and options_1_4) loose the table format and doesn´t work the selection

I tried to with the following code but the same result:
Code: Select all
<cms:repeat count="4">
  <cms:repeatable name="options_1_<cms:show k_count/>">
    <cms:editable name="option"
                  type="dropdown"
                  opt_values="Option 1 | Option 2 | Option 3"
    />
  </cms:repeatable>
</cms:repeat>


When doing this without involving new repeatable regions (display a new text type editable region each time the option "1" was selected) it works fine, so i wonder is there a limitation on placing a repeatable region inside a "show_repeatable" or "repeat" tag or there´s another way this can be done?
Hi ar2ro,

While I am not sure of what you are trying to do ( :) ), I tried out your code and, yes, only the first repeatable-region shows the child regions.

I checked the PHP code behind the repeatable-region and it turns out that the first iteration removes all the child tags so the next iterations have nothing as their children.

As to why this is explicitly done, I cannot say as I don't remember it right now. But I am sure that I wouldn't have done that (i.e. removing the children) without good reason. Perhaps, it had some bearing later in the execution.

Anyways, that means that, I am afraid, it won't work the way you are trying.
Thankyou kk well basically I'm trying to allow client to display a snippet as many time as he want in a same page each time with different content in it (example: multiple sliders) I'll try another approach, if I can achieve it will post it here for others use.
3 posts Page 1 of 1