• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Radio Buttons Custom Fields Code

Michael

Active member
#1
Hey everyone,

I am wanting to use radio button custom fields to change some text depending on member selection for example:

Bob can choose between cars and nothing else, if he chooses cars I want cars to display in the message template, if he chooses nothing else I want a default text to display instead.

Does anyone know how to get this to work with radio buttons?

I have done some searching but the code I have found doesnt appear to work.

Thank you.

@Jake Bunce do you have any idea on this one? :D Thanks
 
Last edited:

Brogan

XenForo moderator
Staff member
#3
I'm not entirely sure what it is you are trying to do, but you will just need to edit the template in which you want the text to appear and use a conditional statement (xen:if) for the custom user field.
 

Michael

Active member
#4
Im wanting to use else ifs for a radio button custom user field within the message template but I am unsure what code to use to get the radio buttons to work correctly. I have tried with a few snippets I have found here but none seem to work for me.

This is the code I am using:

Code:
<xen:if is="{$message.customFields.my_fieldid.on} == 'on'">Blue<xen:else />Pink</xen:if>
When either option is selected under personal details it doesnt seem to have any effect on the output and only Pink is showing regardless of the option chosen.

Hope that makes it clearer what I am trying to do here :)
 

Brogan

XenForo moderator
Staff member
#7
An example:
Code:
<xen:if is="{$visitor.customFields.FieldName}">
    Text to display if the field is checked
<xen:else />
    Text to display if the field is not checked
</xen:if>
 

Michael

Active member
#8
An example:
Code:
<xen:if is="{$visitor.customFields.FieldName}">
    Text to display if the field is checked
<xen:else />
    Text to display if the field is not checked
</xen:if>
Thank you Brogan I will give that a try. Do you know the code if I wanted to add multiple options to the checkboxes?