From 0b50d7b5da605626f1414237b861cef027b6092c Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 22 Sep 2017 10:28:46 +0200 Subject: [PATCH] Fix "Uncaught TypeError: Cannot read property 'slice' of undefined" --- main/inc/lib/formvalidator/Element/SelectAjax.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/formvalidator/Element/SelectAjax.php b/main/inc/lib/formvalidator/Element/SelectAjax.php index f769c66833..d327229528 100644 --- a/main/inc/lib/formvalidator/Element/SelectAjax.php +++ b/main/inc/lib/formvalidator/Element/SelectAjax.php @@ -95,9 +95,14 @@ class SelectAjax extends HTML_QuickForm_select }; }, processResults: function (data, page) { - //parse the results into the format expected by Select2 + // Parse the results into the format expected by Select2 + if (data.items) { + return { + results: data.items + }; + } return { - results: data.items + results: '' }; } $formatCondition