XF 2.0 <xf:dependent> inside select input?

nocte

Well-known member
I want to change this code in the account_privacy template:
HTML:
<xf:macro name="privacy_option" arg-user="!" arg-name="!" arg-label="!" arg-hideEveryone="{{ false }}" arg-hideFollowed="{{ false }}">
    <dl class="inputLabelPair">
        <dt>{$label}</dt>
        <dd>
            <xf:select name="privacy[{$name}]" value="{$user.Privacy.{$name}}">
                <xf:if is="!$hideEveryone">
                    <xf:option value="everyone">{{ phrase('all_visitors') }}</xf:option>
                </xf:if>
                <xf:option value="members">{{ phrase('members_only') }}</xf:option>
                <xf:if is="!$hideFollowed">
                    <xf:option value="followed">{{ phrase('people_you_follow') }}</xf:option>
                </xf:if>
                <xf:option value="none">{{ phrase('nobody') }}</xf:option>
            </xf:select>
        </dd>
    </dl>
</xf:macro>
I want to add another option and if that option is chosen, I want to show some dependent inputs.

With an radio element i could do this easily with <xf:dependent>My inputs</xf:dependent> inside an <xf:option> element. But this does not work with selects (i get an template error while saving). :(

Any ideas?
 

Jeremy P

XenForo developer
Staff member
If I remember correctly, disablers only work on checkboxes and radios so those are the only ones that are able to have dependent inputs. You could likely accomplish something similar with a custom JS handler though.
 
Top