Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I am trying to show/hide a button in accordance with the selected radio button.

I have the following editable;

Code: Select all

<cms:editable name='button_state'
  opt_values='Show = block | Hide = none'
  type='radio'
/>



I want to get the value of the selected radio button and use this as the 'display' styling of the button element.

Code: Select all
<button class="infoButton" style="display:<cms:get button_state />">Get Info</cms:editable></button>


This didn't work out. How can I achieve this functionality?
Hi,

You can use <cms:show> tag instead of <cms:get> to output the value e.g as follows -
Code: Select all
<button class="infoButton" style="display:<cms:show button_state />">Get Info</cms:editable></button>

As for the <cms:get> tag, even it will work but it expects the name of the variable as 'string' - the correct syntax would be this (notice the quotes around the name of the region that make this a 'string') -
Code: Select all
<button class="infoButton" style="display:<cms:get 'button_state' />">Get Info</cms:editable></button>

In case you are wondering why there are two tags and why the difference in the way they expect their parameters please see
http://docs.couchcms.com/tags-reference/get.html

Hope it helps.
2 posts Page 1 of 1
cron