Skip to content

Instantly share code, notes, and snippets.

@spikemanana
Created April 25, 2011 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spikemanana/940053 to your computer and use it in GitHub Desktop.
Save spikemanana/940053 to your computer and use it in GitHub Desktop.
MODx Revo Custom Input Type with two fields(textfield and dropdown)
<input id="tv{$tv->id}" name="tv{$tv->id}"
type="text" class="textfield"
value="{$tv->get('value')|escape}"
{$style}
tvtype="{$tv->type}"
/>
<select id="tv{$tv->id}" name="tv{$tv->id}">
{foreach from=$tvitems item=item}
<option value="{$item.value}" {if $item.selected} selected="selected"{/if}>{$item.text}</option>
{/foreach}
</select>
<script type="text/javascript">
// <![CDATA[
{literal}
var fld = MODx.load({
{/literal}
xtype: 'textfield'
,applyTo: 'tv{$tv->id}'
,width: '97%'
,enableKeyEvents: true
{literal}
,listeners: { 'keydown': { fn:MODx.fireResourceFormChange, scope:this}}
});
MODx.makeDroppable(fld);
{/literal}
{literal}
MODx.load({
{/literal}
xtype: 'combo'
,transform: 'tv{$tv->id}'
,id: 'tv{$tv->id}'
,triggerAction: 'all'
,typeAhead: false
,editable: false
,width: '97%'
{literal}
,listeners: { 'select': { fn:MODx.fireResourceFormChange, scope:this}}
});
{/literal}
// ]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment