{% import "_includes/forms" as forms %} {% macro lazyCreateSelect(selectParams, newOptionLabel, modalHeading, html, js, action, successText) %} {% from "_includes/forms" import selectField %} {{ selectField(selectParams) }} {% js %} (function() { var $select = $('#{{ selectParams.id }}').selectize({ dropdownParent: 'body' }); var selectize = $select.get(0).selectize; selectize.addOption({ value: 'new', text: '{{ newOptionLabel|e("js") }}' }); selectize.on('item_add', function(value, $item) { if (value == 'new') { // Not a real option selectize.clear(); var $form = $( '