Skip to content

Commit

Permalink
Merge pull request #33423 from dimagi/jt/dropdown_placeholder_text
Browse files Browse the repository at this point in the history
Adds standard placeholder text to query dropdown
  • Loading branch information
Jtang-1 authored Sep 1, 2023
2 parents e933345 + a79045a commit 948ad99
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,29 @@ hqDefine("cloudcare/js/formplayer/menus/views/query", function () {
self.parentView.setStickyQueryInputs();
},

onRender: function () {
_initializeSelect2Dropdown: function () {
let placeHolderText;
switch (this.model.get('input')) {
case 'select1':
placeHolderText = gettext('Please select one');
break;
case 'select':
placeHolderText = gettext('Please select one or more');
break;
default:
placeHolderText = ' ';
break;
}

this.ui.valueDropdown.select2({
allowClear: true,
placeholder: " ", // required for allowClear to work
placeholder: placeHolderText, // required for allowClear to work
escapeMarkup: function (m) { return DOMPurify.sanitize(m); },
});
},

onRender: function () {
this._initializeSelect2Dropdown();
this.ui.hqHelp.hqHelp();
cloudcareUtils.initDatePicker(this.ui.date, this.model.get('value'));
this.ui.dateRange.daterangepicker({
Expand Down

0 comments on commit 948ad99

Please sign in to comment.