XF 1.3 radio button conditional

woody

Well-known member
I'm trying the following code in various ad_position templates, and I'm just not seeing why it's not working...

Code:
<xen:if is="{$visitor.customFields.code_navbar.block_one} == 'off'">
display content - block one
<xen:else />
do not display content
</xen:if>

<xen:if is="{$visitor.customFields.code_navbar.block_two} == 'off'">
display content - block two
<xen:else />
do not display content
</xen:if>

Trying to allow for user selection to see or not see specific sections based on their radio button selection in their Preferences.

Thanks for any assistance :)
 
Not sure the syntax of your custom field is correct.

What is the output in the template if you simply have this line:

{xen:helper dump, $visitor.customFields}
 
Code:
array(9) {
["code_navbar"] => array(2) {
["block_two"] => string(17) "block_two"
["block_one"] => string(16) "block_one"
}
}

In the output code, neither block_two or block_one are checked in my Preferences...if they are NOT checked, then this:

Code:
array(9) {
["code_navbar"] => array(0) {
}
 
Last edited:
Code:
array(9) {
["code_navbar"] => array(2) {
["block_two"] => string(17) "block_two"
["block_one"] => string(16) "block_one"
}
}

In the output code, neither block_two or block_one are checked in my Preferences...if they are NOT checked, then this:

Code:
array(9) {
["code_navbar"] => array(0) {
}
That's correct then...

They are not checked so they have no value.

So you just need to change:
Code:
<xen:if is="{$visitor.customFields.code_navbar.block_one} == 'off'">

To:
Code:
<xen:if is="!{$visitor.customFields.code_navbar.block_one}">
 
Top Bottom