Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hello,

is there a possibility to insert the row id of a repeatable region? For example I have three buttons:

Code: Select all
<cms:show_repeatable 'buttons' >

<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".bs-example-modal-sm"><cms:show row_id /></button>

</cms:show_repeatable>


Thanks
C.
Hi Conrad :)

I think you can use 'k_count' variable in your code
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".bs-example-modal-sm"><cms:show k_count />

If required you may set the 'startcount' parameter of cms:show_repeatable tag to make k_count begin from a particular value
<cms:show_repeatable 'buttons' startcount='5'>

TIP: Placing <cms:dump /> or <cms:dump_all /> at any place in your code will show you a list of all the variables available for use at that place.

Does this help?
Hey KK,

thanks for your answer!
Unfortunately your suggestion does not work for me.

I have a product listing where the products all use the repeatable tag. That means using <cms:show k_count /> is ok for the buttons only, or when displaying only one product.

When there are two or more products some buttons will eventually have the same id.

I solved this for now in a way that you have to insert a made up id in the admin page of the product. So the buttons (which are supposed to open a modal window) can have their own id.

Before i had the problem, that the first button would also open the first modal windows of the other products.

thx
C.
Thanks for letting us know, Conrad.
Your approach is perfect for the problem you had.
I don't understand how the button text relates to the requirement of a unique id, but you shouldn't need an additional field just for this... The following should be unique:
Code: Select all
modal-<cms:show k_page_id/>-</cms:show k_count/>
Maybe there is a way to add a field to your repeatable region with an autoincremential function: each time you add a row the field becomes the value +1 to the last repeated region:

starting with
myrow = 0 for the first
adding +1 to each row following.

can couch have such fields depending on other repeatable-fields?
* * * * * * I LOVE COUCH CMS - flexible and straight forward * * * * * *
@chichi, rows can be rearranged (drag-n-drop) and deleted - how do you propose this work with the solution you mentioned?
7 posts Page 1 of 1
cron