Forum
Conditional on checkbox in Blog
Hi there,
First, thanks for adding the scope feature to blocks - very useful!
I'm having trouble getting a conditional statement to work:
<perch:block type="bl-writing" label="Writing">
<div class="tl-entry tl-writing">
<perch:blog id="excerpt" type="textarea" editor="redactor" markdown="false" html="true" size="m" words="30" label="Excerpt for the Timeline (max 30 words)" order="2"/>
<perch:blog id="hide-link" type="checkbox" label="Comment only - don't show a link" value="nolink" suppress="true" />
<perch:if id="hide-link" value="nolink" match="neq">
<div class="external-links">
<a href="invigilators/<perch:blog id="parent.authorSlug" type="text" />" target="_blank">
<img src="assets/icons/icon_newtab.png" alt="Icon - open in new tab" title="Open this article in a new tab"/>
<span>Invigilator's posts</span>
</a>
</div>
</perch:if >
</div>
</perch:block>
The value of 'hide-link' is present in the debug output:
Array
(
[postTitle] => The future has not yet been created - November
[month-selector] => nov
[_blocks] => Array
(
[0] => Array
(
[excerpt] => Array
(
[raw] =>
The future has not yet been created
[processed] =>
The future has not yet been created
)
[hide-link] => nolink
[parent.authorSlug] =>
[_block_type] => bl-writing
[_block_id] => nnxwf0
[_block_index] => 0
)
)
[postDateTime] => 2015-05-06 18:54:00
[categories] =>
so I imagine I'm doing something wrong in the if statement. Basically the problem is that the elements that should be hidden when the checkbox is activated are still being displayed. Can you see if I'm doing something wrong here?
Thanks a lot.
Your if is saying "if
hide-link
is not equal tonolink
", yet the output shows thathide-link
is equal tonolink
.