Forum
Show hide fields in CMS
HI Guys,
Is it possible to show hide fields in the CMS depending on the result of a radio or checkbox.
I have this code:
<perch:content id="btn-type" title="true" type="radio" label="Button Type" help="Select if the button should link to a page or modal" options="Modal, Link"/>
<perch:if id="link-type" value="Modal">
<button class="btn__warning--gradient btn-lg" data-toggle="modal" data-target="#<perch:content id="modal-link" title="true" type="text" label="Modal Name" />"><perch:content id="modal-text" title="true" type="text" label="Button Text" /></a>
</perch:if>
<perch:if id="link-type" value="Link">
<a class="btn__warning--gradient btn-lg" href="<perch:content id="btn-link" title="true" type="text" label="Button Link" />"><perch:content id="btn-text" title="true" type="text" label="Button Text" /></a>
</perch:if>
If the button is a modal pop up I want to only show the options within that perch:if and the same for if the button is a link,
Is this possible?
Cheers
It's not possible currently. It's something a few people have asked, so it's certainly on the radar.
Cool, good to know, it would be a pretty good feature and enable some nice UX in the CMS
Major +1 - i've been doing this with JS on the Gallery and Blog app UIs but it's much more effort to manipulate Content region fields because each field and label is preceded by an ID, making selection tricky e.g. (input id="perch_23_item").
Below is a Blog post example that controls the UI for featured posts (sale or exhibit), obviously the fields need to change for each selection. There's also some fallback live validation happening because these fields even though technically 'required' in their respective circumstances cannot be marked as such using traditional perch required="required" or we'd block the entire post action.
I realise this is rudimentary but it does work with some effort and creates a situation of flexibility and idiot proof advanced editing which my client really appreciates!
The output of this can usually be found on the homepage here: https://edenbaneart.com/
For reference I was prompted to the possibility of this from here: https://docs.grabaperch.com/docs/customizing-perch/ui-customizations/
Hi Drew, looks like it was something to do with the Author template, as I've taken that out of the Blog template and now I can save a blog post and it'll show up properly. The Slug is showing as "/2015-2015-06-11-11-paul-test-15" now though.
Have you ever seen the date repeat like that? In settings it's the slug is set to: