// add <option /> if item represents a value not present in one of the <select />'s options
if (self.isSelect && !optionExists) {
- var $option = $('<option selected>' + htmlEncode(itemText) + '</option>');
+ var $option = $('<option>' + htmlEncode(itemText) + '</option>');
$option.data('item', item);
$option.attr('value', itemValue);
self.$element.append($option);
tagsinput = new TagsInput(this, arg1);
$(this).data('tagsinput', tagsinput);
results.push(tagsinput);
-
- if (this.tagName === 'SELECT') {
- $('option', $(this)).attr('selected', 'selected');
- }
-
// Init tags from $(this).val()
$(this).val($(this).val());
} else if (!arg1 && !arg2) {
-<select name="recipient" class="form-control input-lg" id="recipient">
+<select name="recipient" class="form-control input-lg" id="recipient" required>
{{foreach $contacts as $contact}}
<option value="{{$contact.id}}"{{if $contact.id == $selected}} selected{{/if}}>{{$contact.name}}</option>
{{/foreach}}
}
});
+ {{if $selected}}
// Import existing ACL into the tags input fields.
$recipient_input.tagsinput('add', acl.get({{$selected}})[0]);
+ {{/if}}
});
</script>