We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42577
    • 5 Posts
    Hi, I made a custom TV from a tutorial for Modx 2.2, everything looks ok.
    So I've added few values for my custom combo - first==1||second==2, then on page TV's values I tried select one of the values, but there just Yes or NO, that strange! How can I fix it ?

    I guess the problem in get values from TV, here is my FilterSelectN.tpl (copied from /manager/templates/default/element/tv/renders/listbox-single.tpl)

    What I need is the same listbox component.

    Thank you!

    <select id="tv{$tv->id}" name="tv{$tv->id}">
    {foreach from=$opts item=item}
    	<option value="{$item.value}" {if $item.selected} selected="selected"{/if}>{$item.text}</option>
    {/foreach}
    </select>
    
    
    <script type="text/javascript">
    // <![CDATA[
    {literal}
    Ext.onReady(function() {
        var fld = MODx.load({
        {/literal}
            xtype: 'combo'
            ,transform: 'tv{$tv->id}'
            ,id: 'tv{$tv->id}'
            ,triggerAction: 'all'
            ,width: 400
            ,allowBlank: {if $params.allowBlank == 1 || $params.allowBlank == 'true'}true{else}false{/if}
    
            {if $params.title},title: '{$params.title}'{/if}
            {if $params.listWidth},listWidth: {$params.listWidth}{/if}
            ,maxHeight: {if $params.maxHeight}{$params.maxHeight}{else}300{/if}
            {if $params.typeAhead}
                ,typeAhead: true
                ,typeAheadDelay: {if $params.typeAheadDelay && $params.typeAheadDelay != ''}{$params.typeAheadDelay}{else}250{/if}
            {else}
                ,editable: false
                ,typeAhead: false
            {/if}
            {if $params.listEmptyText}
                ,listEmptyText: '{$params.listEmptyText}'
            {/if}
            ,forceSelection: {if $params.forceSelection && $params.forceSelection != 'false'}true{else}false{/if}
            ,msgTarget: 'under'
    
        {literal}
            ,listeners: { 'select': { fn:MODx.fireResourceFormChange, scope:this}}
        });
        Ext.getCmp('modx-panel-resource').getForm().add(fld);
    });
    {/literal}
    // ]]>
    </script>
      • 42577
      • 5 Posts
      ok, found, I forgot copy right code from listbox.class.php

      now everything is works smiley

      [ed. note: bjorn_02 last edited this post 13 years, 8 months ago.]