XF 2.2 Custom Thread Feld combine dropdown selection with text field

Mr Lucky

Well-known member
I want users to make a selection either from preset options for choice files OR a text box as a kind of "Other, please specify" field.

I could do this with two fields (one dropdown and one text), but only if neither were required because I want to require the user to either choose drop down or write what they want - but must be one or the other.

Does anyone know how I could achieve this?

Seems like it may be done similar to a question i had as to if there could be conditional fields, so that one choice from field 1 could be "other" and that would trigger field 2 to be required (other wise it would be hidden) and field two would be a text box. wew see this so often, there must be a know way.

Have you looked at simply having a field 2 text box be there all the time and a final option for field 1 being "Other, please specify below"?
Is the issue folks not filling out the text box?

I'm not experienced in Xenforo, so I'm just pondering with you


Well-known member
This is not possible out of the box.

You most likely could achive this with a template modification for macro custom_field_macros::custom_fields_edit_textbox:

Check the field ID and if it is the desired field display a <select> with the desired options above the textfield, add JS to update the the textfield value if an entry is selected

<xf:if is="$definition.field_id == 'my_field_id'">
    <select class="field_select input" onchange="$('#{$refId}').val($(this).val())" style="width:auto;margin-bottom:10px">
        <option />
        <option value="Foo">Foo</Foo>
        <option value="Bar">Bar</option>

Not nice nor recommended, but should work.

https://xenforo.com/community/threads/cv6-custom-field-extension.194853/ gets pretty close to work for your usecae, but needs some tweaks (as suggested in https://xenforo.com/community/threads/cv6-custom-field-extension.194853/post-1586360) to do what you want.