<div>
    [{isys type='f_popup' p_strPopupType='dialog_plus' p_strTable="isys_dialog_plus_custom" p_identifier=$field.identifier condition="isys_dialog_plus_custom__identifier = '`$field.identifier`'" name="C__CATG__CUSTOM__`$key`"}]

    [{if $field.multiselection > 0}]
    <script type="text/javascript">
        (function () {
            'use strict';

            var dialogPlusFieldId = '[{"C__CATG__CUSTOM__`$key`"}]',
                $dialogPlus = $(dialogPlusFieldId),
                dialogPlusSelection = [],
                chosenInstance = null;

            if ($dialogPlus) {
                $dialogPlus.on('custom-event:updated', function () {
                    $dialogPlus.select('option').each(function (ele) {
                        if (ele.selected && dialogPlusSelection.indexOf(ele.value) < 0) {
                            dialogPlusSelection.push(ele.value);
                        }
                    });

                    if (chosenInstance !== null) {
                        // Update selection
                        $dialogPlus.setValue(dialogPlusSelection).fire('chosen:updated');
                    } else {
                        chosenInstance = new Chosen($dialogPlus, {
                            default_multiple_text:     '[{isys type="lang" ident="LC__UNIVERSAL__CHOOSEN_PLACEHOLDER" p_bHtmlEncode=false}]',
                            placeholder_text_multiple: '[{isys type="lang" ident="LC__UNIVERSAL__CHOOSEN_PLACEHOLDER" p_bHtmlEncode=false}]',
                            no_results_text:           '[{isys type="lang" ident="LC__UNIVERSAL__CHOOSEN_EMPTY" p_bHtmlEncode=false}]',
                            disable_search_threshold:  10,
                            search_contains:           true
                        });
                    }
                });

                $dialogPlus.fire('custom-event:updated');
            }
        })();
    </script>
    [{/if}]
</div>