# Repeater in repeater

**URL:** <https://community.hubspot.com/t/repeater-in-repeater/27679>\
**Category:** CMS Development\
**Tags:** developer-tools\
**Created:** [November 6, 2020, 7:20am UTC](https://community.hubspot.com/t/repeater-in-repeater/27679 "2020-11-06T07:20:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyKaq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kykaq/32/29368_2.png) [@kyKaq](https://community.hubspot.com/u/kyKaq)\
**Post date:** [November 6, 2020, 7:20am UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/1 "2020-11-06T07:20:23Z")

</div>

Good day, I have created a repeater. Then I wanted to create create a repeater ion top of it.

This is my current code:  
\<section class=“module”\>  
\<div class=“columns-wrapper”\>  
{% for item in module.card\_item %}  
\<div class=“card-item”\>  
\<div class=“card”\>  
{% if item.card\_image.src %}  
\<div class=“card-img-top” style=“background:url(‘{{ item.card\_image.src }}’) no-repeat; background-size: cover; background-position: center;”\>\</div\>  
{% endif %}  
\<div class=“card-body”\>  
\<h2 class=“card-title”\>{{ item.card\_title }}\</h2\>  
\<div class=“card-text”\>  
{{ item.card\_text }}  
\</div\>  
\</div\>  
\</div\>  
\</div\>  
{% endfor %}  
\</div\>  
\</section\>

 ![33962iD0519C37A6D817E3.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/c/9cebda77625d106b9e26e9abe7d13e171571e3db.png)

Then I wanted to create in inside the repeater:  
\<section class=“module-{{ name }}”\>  
{% for item in module.repeater %}  
\<div class=“columns-wrapper”\>  
{% for item2 in item.card\_item %}  
\<div class=“card-item” style=“margin: {{ item.setting.padding\_size }}px;”\>  
\<div class=“card”\>  
{% if item2.card\_image.src %}  
\<div class=“card-img-top” style=“background:url(‘{{ item2.card\_image.src }}’) no-repeat; background-size: cover; background-position: center;”\>\</div\>  
{% endif %}  
\<div class=“card-body”\>  
\<h2 class=“card-title”\>{{ item2.card\_title }}\</h2\>  
\<div class=“card-text”\>  
{{ item2.card\_text }}  
\</div\>  
\</div\>  
\</div\>  
\</div\>  
{% endfor %}  
\</div\>  
{% endfor %}  
\</section\>

But then erorr occur as it show like this

 ![33961i6B001EA911B24DED.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/a/da01a739d7620a0f8888ab9a86bbbda0319d8699.png)

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 6, 2020, 6:24pm UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/2 "2020-11-06T18:24:40Z")

</div>

Hi @kyKaq ,

Thanks for the question

Wondering if @jonchim or @dbeau79 have some ideas about this 😀

---

<div class="post-metadata">

**Author:** ![dbeau79](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbeau79/32/82797_2.png) [@dbeau79](https://community.hubspot.com/u/dbeau79)\
**Post date:** [November 6, 2020, 6:33pm UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/3 "2020-11-06T18:33:19Z")

</div>

@dennisedson thanks for tagging me.

@kyKaq can you post in your html and screenshot the field section in your module? I’m thinking you might not have your second repeater nested in your first repeater properly. There’s no issue with what you are trying to do. It should work.

---

<div class="post-metadata">

**Author:** ![kyKaq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kykaq/32/29368_2.png) [@kyKaq](https://community.hubspot.com/u/kyKaq)\
**Post date:** [November 9, 2020, 2:33am UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/4 "2020-11-09T02:33:19Z")

</div>

Hi, @dbeau79 .  
I had successfully added the repeater. However, I am now facing the problem of the setting.  
However, a new problem is faced. I wanted to enable it to able to customize each of the repeaters. but, the new problem I face is I am unable to edit through the first repeater. And when I edit in the second repeater It will affect the first repeater as well. How can I do so that I can customize each of the repeaters?  
This is my code:

\<section class=“module”\>  
\<div class=“repeater-wrapper-{{ id }}”\>  
{% for item in module.repeater %}  
\<div class=" columns-wrapper-{{ name }}“\>  
{% for item2 in item.card\_item %}  
\<div class=“card-item” style=“margin: {{ item.setting.padding\_size }}px;”\>  
\<div class=“card”\>  
{% if item2.card\_image.src %}  
\<div class=“card-img-top” style=“background:url(‘{{ item2.card\_image.src }}’) no-repeat; background-size: cover; background-position: center;”\>\</div\>  
{% endif %}  
\<div class=“card-body”\>  
\<h2 class=“card-title”\>{{ item2.card\_title }}\</h2\>  
\<div class=“card-text”\>  
{{ item2.card\_text }}  
\</div\>  
\</div\>  
\<div class=“card-url”\>  
\<div class=“card-button”\>  
{% cta guid=”{{ item2.cta\_field }}" %}  
\</div\>  
\</div\>  
\</div\>  
\</div\>  
{% endfor %}  
\</div\>

\<style\>  
section.module .repeater-wrapper-{{ id }} {  
top:-{{ item.overlay\_on\_top\_setting.index\_to\_move\_top }}px;  
padding-top:{{ item.setting.distance\_above }}px;  
padding: 50px 0;  
max-width:100%;  
Z-index:1000;  
}  
section.module .repeater-wrapper-{{ id }} .columns-wrapper-{{ name }} {  
display: flex;  
flex-wrap: wrap;  
max-width: 100%;  
top:-{{ item.overlay\_on\_top\_setting.index\_to\_move\_top }}px;  
position:{{ item.overlay\_on\_top\_setting.overlay\_on\_top\_element }};  
padding-top:{{ item.setting.distance\_above }}px;  
}  
section.module .repeater-wrapper-{{ id }} .columns-wrapper-{{ name }} .card-item {  
display: flex;  
flex-wrap: wrap;  
max-width: 100%;  
box-shadow: 5px 5px 2px 0 rgba(0, 0, 0, 0.2);  
width:{{ item.setting.card\_size }}%;  
border-radius: {{ item.setting.card\_corner }}px;  
box-shadow: {{ item.setting\_of\_shadow.shadow\_move\_right }}px {{ item.setting\_of\_shadow.shadow\_move\_bottom }}px {{ item.setting\_of\_shadow.blurity\_of\_shadow }}px 0 rgba(0, 0, 0, 0.{{ item.setting\_of\_shadow.darkness\_of\_shadow }});  
background-color:{{ item.setting.card\_background\_colour.color }};  
position: relative;  
overflow: hidden;  
height: 100%;  
text-align: left;

}  
\</style\>  
{% endfor %}  
\</div\>  
\</section\>

And this is the image of my module:

 ![34026iB23EC9B6CD71E21B.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/2/720afe62c18583b865db8e05605e5816913afa7d.png)

 ![34027i779E59BE4E058DE9.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/f/efe085832249390eda3286bf820ba9156033f809.png)

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [November 9, 2020, 2:06pm UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/5 "2020-11-09T14:06:48Z")

</div>

Hi @kyKaq ,

Can you also provide us with a screenshot of the fields you have on the right side?  
Looks like you might be missing an {% endfor %} and a closing \</div\>

---

<div class="post-metadata">

**Author:** ![kyKaq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kykaq/32/29368_2.png) [@kyKaq](https://community.hubspot.com/u/kyKaq)\
**Post date:** [November 10, 2020, 12:56am UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/6 "2020-11-10T00:56:56Z")

</div>

Hi @jonchim

This is the right side of my module

 ![34061i048C40AD92426709.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/7/371da6af0afbcf75f3f9206a4faf4cb7b327f8c3.png)

 ![34062i0F11083E34ED5A29.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/e/1efa2941868bf3a4880de7c60147c7498ba45d37.png)

 ![34063i191F3BEBB25F06AE.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/d/ddedd525edbaa79110d296e70382247fe01315c3.png)

 ![34064iD88047D2626F7C31.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/c/cc6bca571b3a9b8e87900f7f97fbc6bf4721796d.png)

And one more things that I just notice is that the unique id for the element is duplicate, maybe that is my problem.

 ![34074i559AB326EBD9FCB7.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/9/a954f9103f27cbfe8a27a1cea914760c8fc30fed.png)

 ![34075i10EEE72E96D1E9AD.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/e/7e1ac73c8f1bc152d97944a1007fe6832bd6c5d2.png)

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [November 10, 2020, 1:53pm UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/7 "2020-11-10T13:53:16Z")

</div>

Hi @kyKaq ,

Thank you for the screenshots, I see that you have multiple groups within the initial repeater group. I think you need all those sub groups with the card settings to group inside the card\_item group maybe another field called card\_settings. Because you want those card settings to only affect the current card item but right now it’s affecting all the cards the same way?

---

<div class="post-metadata">

**Author:** ![kyKaq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kykaq/32/29368_2.png) [@kyKaq](https://community.hubspot.com/u/kyKaq)\
**Post date:** [November 19, 2020, 7:35am UTC](https://community.hubspot.com/t/repeater-in-repeater/27679/8 "2020-11-19T07:35:37Z")

</div>

I found the solution myself, the {{ name }} will return the same id every time. Then I change to {{ loop.index }}, it gives me a different unique id every time.  
But I also want to thanks for your help.
