Forum
Perch block content not appearing if image field contains upload
Hi there,
I have a shared multi-item region called services. Inside are a couple of core fields such as title and image. I have two image fields for producing two sizes from the same ID. The rest of the users fields for adding content are coming from block content via a template include.
When I save my region - aftering add a service - all my block content vanishes or sometimes, one is left behind. Images to appear to be working correctly when output and I can't find any reason why this is happening. However if I leave my image field blank, the block content works correctly.
I've double checked for duplicate IDs and blank fields. I've also tried changing IDs on the image field in question. I'm using the most recent version of Perch.
The template:
<div class="page-Banner sub-Page" style="background-image:url(<perch:content id="serv_image" type="image" label="Service Image" crop="true" width="1600" height="600" />);">
<div class="page-Banner_Text">
<div>
<h1><perch:content id="serv_name" type="text" label="Service title" required></h1>
</div>
</div>
</div>
<div class="service-Specific is-Padded">
<div class="contain">
<perch:content id="slug" type="slug" for="serv_name" editable="true" label="Slug" label="Service Image" help="Sets the URL in the address bar" suppress>
<perch:content id="serv_image" type="image" width="900" height="600" crop="true" suppress>
<perch:content id="is_featured" type="checkbox" label="Is this service featured?" help="Featured will output the service on the homepage" value="featured" suppress>
<div class="anchored-Content">
<div class="anchored-Content__nav">
<perch:if exists="heading_nav">
<div><perch:content id="heading_nav" encode="false" type="hidden"></div>
</perch:if>
</div>
<div class="anchored-Content__content">
<div class="content-anchor">
<perch:template path="content/service_blocks.html" rescope="parent" />
<perch:layout path="global/services_cta">
</div>
</div>
</div>
</div>
</div>
No errors are coming up in the debug so I have nothing to follow at the moment. My blocks include looks like:
<perch:blocks>
<perch:block type="heading" label="Single Heading" icon="pencil">
<div class="block-Heading e-content">
<h1><perch:content id="heading" type="text" label="Single heading" markdown="true" editor="markitup" /></h1>
</div>
</perch:block>
<perch:block type="anchorHeading" label="Anchored Heading" icon="pencil">
<div class="block-Heading is-Anchored e-content">
<perch:content id="heading_opt" type="select" label="Please select what type of heading you'd like" options="Heading one|h1, Heading two|h2, Heading three|h3, Heading four|h4, Heading five|h5" allowempty="false" suppress required>
<perch:content id="anchor_heading" type="text" label="Heading text" encode="false">
</div>
</perch:block>
<perch:block type="textblock" label="Paragraph" icon="pencil">
<div class="block-Paragraph e-content">
<perch:content id="postDescHTML" type="textarea" label="Large paragraph field" markdown="true" editor="markitup" size="l autowidth" />
</div>
</perch:block>
<perch:block type="textintro" label="Intro text" icon="pencil">
<div class="block-Paragraph intro-Paragraph e-content">
<perch:content id="introText" type="textarea" label="Great for use with your first paragraph" markdown="true" editor="markitup" size="xl autowidth" />
</div>
</perch:block>
<perch:block type="embed" label="Embed" icon="code">
<div class="block-Paragraph is-Embed e-content">
<perch:content id="embed_code" type="textarea" label="Paste your embed code here" html="true" size="xl autowidth" />
</div>
</perch:block>
</perch:blocks>
Have you tried breaking it down to isolate the problem? This doesn't sound like a very sensible architecture, but I'd still expect it to function.
Do you mean the way in which I am using blocks are my template in general?
I have stripped the template down and the block template as well and have not been able to find anything apart from the image fields that cause the issue. I may try deleting my region and creating it again.
After spending all weekend looking at the cause the only thing I can notice as a constant is this. With only a single block in my blocks template, which a textarea field - used in conjunction with my image field, the problem persists. I complete the fields like so:
In this scenario only text block 2 is being saved and appearing on the page reload. The same happens if I add three blocks, only block 2 is present after save.
I've stripped my core fields into their own template away from my HTML and it looks like:
Hi Drew,
I've just looked and I am actually getting an error in the console from one of the core js files. I only thought to look after I noticed once I used my image field, that the markup buttons were not appearing on my textarea block, whereas if I don't use the image field, they appear fine.
I've tried reinstalling my core. I will attempt to do so again.
Could you post your diagnostics?
Sure:
Hi Drew,
Just an update to this. I've rolled back to Perch 3.0.10 and it's working again so for now I will just leave the site at this older version.