@@ -192,50 +192,50 @@ For full license text, see the LICENSE file in the repo root or https://opensour
192192 { escape: true }
193193 );
194194 },
195- searchRecords: function (key) {
196- j$('#' + key.attr('aria-activedescendant')).show();
197- //Grabbing The Input Field Value
198- var searchKey = key.val();
199- if (searchKey == '') {
200- j$('#' + key.attr('aria-activedescendant')).hide();
201- }
202- var searchList = '';
203- Visualforce.remoting.Manager.invokeAction(
204- '{!$RemoteAction.ActionPlanCreationController.searchTemplates}',
205- searchKey,
206- function (result, event) {
207- if (event.status) {
208- records = result;
209- if (records.length > 0) {
210- for (var i = 0; i < records.length; i++) {
211- //List Elements With Onclick and ID Attributes
212- var objectIcon = '{!URLFOR($Asset.SLDS, "assets/icons/custom-sprite/svg/symbols.svg#custom39")}';
213- // Escape HTML to prevent XSS attacks
214- var escapedName = j$('<div>').text(records[i].Name).html();
215- var escapedId = j$('<div>').text(records[i].Id).html();
216- searchList +=
217- '<li onclick="LightningLookupScripts.recInfo(\'' +
218- escapedId.replace(/'/g, "\\'") +
219- '\');" class="slds-lookup__item"><a id="' +
220- escapedId +
221- '" href="#" role="option"><svg aria-hidden="true" class="slds-icon slds-icon-custom-custom39 slds-icon_small">' +
222- '<use xlink:href="' +
223- objectIcon +
224- '"></use></svg>' +
225- escapedName +
226- '</a></li>';
195+ searchRecords: function (key) {
196+ j$('#' + key.attr('aria-activedescendant')).show();
197+ //Grabbing The Input Field Value
198+ var searchKey = key.val();
199+ if (searchKey == '') {
200+ j$('#' + key.attr('aria-activedescendant')).hide();
201+ }
202+ var searchList = '';
203+ Visualforce.remoting.Manager.invokeAction(
204+ '{!$RemoteAction.ActionPlanCreationController.searchTemplates}',
205+ searchKey,
206+ function (result, event) {
207+ if (event.status) {
208+ records = result;
209+ if (records.length > 0) {
210+ for (var i = 0; i < records.length; i++) {
211+ //List Elements With Onclick and ID Attributes
212+ var objectIcon = '{!URLFOR($Asset.SLDS, "assets/icons/custom-sprite/svg/symbols.svg#custom39")}';
213+ // Escape HTML to prevent XSS attacks
214+ var escapedName = j$('<div>').text(records[i].Name).html();
215+ var escapedId = j$('<div>').text(records[i].Id).html();
216+ searchList +=
217+ '<li onclick="LightningLookupScripts.recInfo(\'' +
218+ escapedId.replace(/'/g, "\\'") +
219+ '\');" class="slds-lookup__item"><a id="' +
220+ escapedId +
221+ '" href="#" role="option"><svg aria-hidden="true" class="slds-icon slds-icon-custom-custom39 slds-icon_small">' +
222+ '<use xlink:href="' +
223+ objectIcon +
224+ '"></use></svg>' +
225+ escapedName +
226+ '</a></li>';
227+ }
228+ } else {
229+ searchList += '<li class="slds-lookup__item">No Records Found</li>';
227230 }
231+ j$('[id$=searchResultsUL]').html(searchList);
228232 } else {
229- searchList += '<li class="slds-lookup__item">No Records Found</li>' ;
233+ alert(event.message) ;
230234 }
231- j$('[id$=searchResultsUL]').html(searchList);
232- } else {
233- alert(event.message);
234- }
235- },
236- { escape: true }
237- );
238- }
235+ },
236+ { escape: true }
237+ );
238+ }
239239 };
240240 checkinput();
241241 </script>
0 commit comments