Forum

Thread tagged as: Question

generated unique id's for a region with multiple entries

Hope this makes sense,

My aim is for the user to input a paragraph of text and on the site it shows the first few lines with a read more. clicking on the read more opens a lightbox with the whole text.

the content is this..

<p>
<perch:content id="text" type="textarea" label="Text" chars="100" markdown="true" editor="markitup" imagewidth="640" imageheight="480" />
<a class="fancybox" href="#test1">read more</a>
</p>
<div id="test1" style="display: none; color:#666;">
<perch:content id="text" type="textarea" label="Text" markdown="true" editor="markitup" imagewidth="640" imageheight="480" />
</div>

The code i'm using relies on having different IDs for when there's more than one entry. Where it the wording "test1" is referenced is there a way for this wording to have a randomly generated unique value?

cheers

John Robinson

John Robinson 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use <perch:content id="perch_item_index" />

many thanks