XF 2.0 Is there an equivalent to XF1's 'TitlePrefix' JS in XF2?

Jaxel

Well-known member
In XF1, I could put in my form:
HTML:
    <select name="prefix_id" id="prefix_id" class="textCtrl autoSize TitlePrefix"
        data-nodecontrol="#node_id"
        data-prefixurl="{xen:link forums/-/prefixes}">
        <xen:include template="title_prefix_edit_options" />
    </select>

    <select name="node_id" id="node_id" class="textCtrl autoSize">
        <option value="0">({xen:phrase select_forum})</option>
        <xen:foreach loop="$forums" value="$forum">
            <option value="{$forum.node_id}">{$forum.title}</option>
        </xen:foreach>
    </select>

This would be a select dropdown with a list of forums. As you select the forum in the second select box, the TitlePrefix JS would fetch that forum's prefixes and use them to populate the first select box. I could not find an equivalent function for this in XF2.
 
I did figure this one out though... but its complicated... and not something I could easily post in a simple response.
 
I mean, it's not that complicated IMO :p

HTML:
<xf:selectrow name="thread_node_id" value="{$product.thread_node_id}" id="js-dbtechEcommercePurchaseNodeList"
              label="{{ phrase('dbtech_ecommerce_automatically_create_purchase_thread_in_forum') }}"
              explain="{{ phrase('dbtech_ecommerce_if_selected_purchase_product_created_thread_posted_forum') }}">

    <xf:option value="0">{{ phrase('(none)') }}</xf:option>
    <xf:foreach loop="$forumOptions" value="$forum">
        <xf:option value="{$forum.value}" disabled="{$forum.disabled}" label="{$forum.label}" />
    </xf:foreach>
</xf:selectrow>

<xf:formrow label="{{ phrase('dbtech_ecommerce_automatically_created_purchase_thread_prefix') }}" rowtype="input">
    <xf:js src="xf/prefix_menu.js" min="1" />
    <xf:macro template="prefix_macros" name="select"
        arg-type="thread"
        arg-prefixes="{$threadPrefixes}"
        arg-selected="{{ $product.thread_prefix_id ?: 0 }}"
        arg-name="thread_prefix_id"
        arg-href="{{ link('forums/prefixes') }}"
        arg-listenTo="#js-dbtechEcommercePurchaseNodeList" />
</xf:formrow>


Fillip
 
Last edited:
Could it be because prior versions of XF2 had a bug where if the prefix ID was 0, you'd get a no permissions popup? I had that as well when developing that feature, but it's been fixed in later versions of XF2.
 
Back
Top Bottom