Forum

Thread tagged as: Question, Field-Types

Load different content depending on selection in region editor.

I have two different types of buttons that could go on a page (a "Call Now", or "Book Now" button), and I want the user to be able to choose which one to put onto the page through the editor.

Ideally I'd like them to have a Select Box to choose either "Call Now Button" or "Book Now Button", and depending on the selection Perch will insert the appropriate HTML markup for the selected button. Is there a simple way to accomplish this?

P.S. Onto my 3rd Perch site in less than 2 weeks... The more I learn the more I love it!

Chad Tiffin

Chad Tiffin 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure:

<perch:content id="button_type" label="Button type" type="select" options="Call Now|call, Book Now|book" suppress="true" />
<perch:if id="button_type" value="call">
    ... call now button goes here ...
</perch:if>
<perch:if id="button_type" value="book">
    ... book now button goes here ...
</perch:if>

Amazing.