Forum

Thread tagged as: Question, Problem

Perch Repeater problem

Hi there

I have a list/detail page for employees that outputs just fine - I'm trying to add in a small section which is a bootstrap panel with an accordion inside it - works just fine on it's own (i.e. when not content managed) so I have tried to incorporate it into the template but using a repeater for each accordion header/content section. I have coded it as below, but when I go to edit the record I can't see the elements within the repeater, only a solid grey bar.

the code is here

<div class="panel panel-default" style="margin-top: 30px;">
<div class="panel-heading" role="tab"><h4><img style="margin-top:-5px; margin-right: 10px; width: 30px;" src="images/news.svg"> <perch:content id="newsperson" type="text" label="Name of person entering news items" help="This area is only intended for Nicole" required="false" /> - In The News</h4></div>
<div class="accordion-container">

<perch:repeater id="newssection" label="News">
<h4 class="accordion-header"><perch:content id="accordiontitle" type="text" label="Item Title" /></h4>
<div class="accordion-content">
<perch:content id="accordiondetail" type="textarea" size="xs" label="Item Copy" markdown="true" editor="markitup" />
</div><!-- accordion-content ends -->
</perch:repeater>


</div><!-- accordion-container ends -->
</div><!-- panel panel-default ends -->

Perch: 2.8.31, PHP: 5.6.25-1~dotdeb.7.1, MySQL: 5.6.32, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31) App runtimes: <?php $apps_list = array( 'content', 'categories', ); PERCH_LOGINPATH: /perch

Ben Read

Ben Read 0 points

  • 5 years ago

I have used the Bootstrap accordion collapse thing on a site with a multi content region and I had to give each section a unique id so the title would trigger the corresponding panel. This was done with perch_item_index https://docs.grabaperch.com/perch/content/templates/unique-ids/ here is my template code if it is any use.

<perch:before>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
</perch:before>

  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="heading<perch:content id="perch_item_index" type="hidden" />">
      <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<perch:content id="perch_item_index" type="hidden" />" aria-expanded="true" aria-controls="collapse<perch:content id="perch_item_index" type="hidden" />">
          <perch:content id="question" type="text" label="Question" html="false" required="true" title="true" help="Enter the Question here" />
        </a>
      </h4>
    </div>
    <div id="collapse<perch:content id="perch_item_index" type="hidden" />" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<perch:content id="perch_item_index" type="hidden" />">
      <div class="panel-body">
       <perch:content id="answer_text" type="textarea" label="Answer Text" html="true" required="true" editor="markitup" markdown="true" help="Enter the answer content here"/>

      </div>
    </div>
  </div>
<perch:after>
  </div>
</perch:after>

Cheers Greg

Appreciate the reply

I'm using a small accordion called Vallenato which doesn't use IDs just classes so the repeater is only intended for the central expanding portion.

It appears there is something going on as I have used the same feature before with no issue - I transposed exactly the same code into a new, blank template as a test and it is not working - I have removed every element one by one to the base accordion and no joy. Incidentally when I save the record in mnage content I see a flash of the accordion elements - there is an image of what it looks like here:

https://www.meyerpartnership.com/images/repeater.png

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you get any errors in your browser console?

Hi Drew

No none... a couple of css token warnings - see pic

https://www.meyerpartnership.com/images/console.png

cheers

Ben

Hang on - just realised that I can see the repeater in Safari but not Chrome (which I was working in) - I need to redo the template and check, but I think that might be the issue!

Yes... it's an issue with Chrome

Version 53.0.2785.143 (64-bit)

Might be an extension conflict, soI'll have a test and come back.

Apologies for the hassle!

cheers

Ben

Yes. Adblock Plus is conflicting - when I turn it off the repeater drop down in the CMS works fine.

Many thanks

Ben