Created
April 25, 2011 01:36
-
-
Save spikemanana/940053 to your computer and use it in GitHub Desktop.
MODx Revo Custom Input Type with two fields(textfield and dropdown)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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