{strip} {if $field.type eq 'R'} {foreach $field.possibilities as $value => $label}
{/foreach} {elseif $field.type eq 'M'} {if empty($field.options_map.inputtype)} {foreach $field.possibilities as $value => $label}
{/foreach} {elseif $field.options_map.inputtype eq 'm'} {if $prefs.jquery_select2 neq 'y'}{tr}Hold "Ctrl" in order to select multiple values{/tr}
{/if} {/if} {else} {if $field.type eq 'D'}
{tr}Other:{/tr}
{jq} $(function () { var $select = $('select[name="{{$field.ins_id|escape}}"]'), $other = $('input[name="other_{{$field.ins_id|escape}}"]'); {{if !isset($field.possibilities[$field.value]) && $field.value}} if (!$('> [selected]', $select).length) { $select.val('other').trigger("change.select2"); } {{/if}} $select.change(function() { if ($select.val() != 'other') { $other.data('tiki_never_visited', ''); $other.val('').parent().hide(); } else { $other.data('tiki_never_visited', 'tiki_never_visited'); $other.parent().show(); } }); $other.change(function(){ $other.data('tiki_never_visited', ''); if ($(this).val()) { $select.val(tr('other')).trigger("change.select2"); } }); $other.focusout(function(){ $other.data('tiki_never_visited', ''); }); }); {/jq} {/if} {/if} {/strip}