Skip to content
Snippets Groups Projects
Commit a3162197 authored by colemanw's avatar colemanw
Browse files

CRM-13966 - select2 - set default & allowClear from markup

parent 704d3260
Branches
Tags
No related merge requests found
......@@ -290,6 +290,13 @@ CRM.validate = CRM.validate || {
$(this).remove();
});
var options = $(this).data('select-params') || {};
// Set placeholder from markup if not specified
if ($(this).is('select:not([multiple])')) {
options.allowClear = options.allowClear !== undefined ? options.allowClear : !($(this).hasClass('required'));
if (options.placeHolder === undefined && $('option:first', this).val() === '') {
options.placeholderOption = 'first';
}
}
// Api-based searching
if ($(this).data('api-params')) {
$(this).addClass('crm-ajax-select')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment