We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38925
    • 38 Posts
    Hi all !

    A long time since my last question laugh

    I want to add properties to a custom TV in Revo 2.1. Here is the code of my properties template :

    <div id="tv-input-properties-form{$tv}"></div>
    {literal}
    
    <script type="text/javascript">
    // <![CDATA[
    var params = {
    {/literal}{foreach from=$params key=k item=v name='p'}
     '{$k}': '{$v|escape:"javascript"}'{if NOT $smarty.foreach.p.last},{/if}
    {/foreach}{literal}
    };
    var oc = {'change':{fn:function(){Ext.getCmp('modx-panel-tv').markDirty();},scope:this}};
    
    MODx.load({
        xtype: 'panel'
        ,layout: 'form'
        ,cls: 'form-with-labels'
        ,autoHeight: true
        ,border: false
        ,labelAlign: 'top'
        ,labelSeparator: ''
        ,items: [{
            xtype: 'modx-combo-source'
    		,fieldLabel: 'Media Source'
    		,name: 'inopt_mediaSource'
    		,id: 'inopt_mediaSource{/literal}{$tv}{literal}'
    		,value: params['mediaSource'] || ''
    		,width: 200
    		,listeners: oc
         },{
            xtype: 'textfield'
            ,fieldLabel: 'Max Size'
            ,name: 'inopt_maxSize'
            ,id: 'inopt_maxSize{/literal}{$tv}{literal}'
            ,value: params['maxSize'] || ''
            ,width: 200
            ,listeners: oc
        },{
            xtype: 'textfield'
            ,fieldLabel: 'Forbidden types'
            ,name: 'inopt_forbiddenTypes'
            ,id: 'inopt_forbiddenTypes{/literal}{$tv}{literal}'
            ,value: params['forbiddenTypes'] || ''
            ,width: 200
            ,listeners: oc
        }]
        ,renderTo: 'tv-input-properties-form{/literal}{$tv}{literal}'
    });
    // ]]>
    </script>
    {/literal}


    My problem is that the mediaSource field isn't saved. It does not appear in $params

    Did I do something wrong ?

    Thanks ! [ed. note: tzoreol last edited this post 14 years, 5 months ago.]
      • 28215
      • 4,149 Posts
      add:

      ,hiddenName: 'inopt_mediaSource'
      


      to the same JSON block that you are calling xtype 'modx-combo-source' to. Note that you have to specify both name and hiddenName for comboboxes in ExtJS.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 38925
        • 38 Posts
        Thanks wink

        Now that the id of the media source is in parameters, how can I get the media source and its basePath ?