From 950e4dab049521478501b82c7a82534e3ab467b9 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 14 Aug 2018 13:23:06 -0700 Subject: [PATCH] Checking for undefined default survey answers --- .../src/templates/survey-maker/surveys/init.factory.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js b/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js index 61f0d2226c..28207ba0e3 100644 --- a/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js +++ b/awx/ui/client/src/templates/survey-maker/surveys/init.factory.js @@ -261,7 +261,7 @@ export default scope.maxTextError = false; if(scope.type.type==="text"){ - if(scope.default.trim() !== ""){ + if(scope.default && scope.default.trim() !== ""){ if(scope.default.trim().length < scope.text_min && scope.text_min !== "" ){ scope.minTextError = true; } @@ -272,7 +272,7 @@ export default } if(scope.type.type==="textarea"){ - if(scope.default_textarea.trim() !== ""){ + if(scope.default_textarea && scope.default_textarea.trim() !== ""){ if(scope.default_textarea.trim().length < scope.textarea_min && scope.textarea_min !== "" ){ scope.minTextError = true; } @@ -283,7 +283,7 @@ export default } if(scope.type.type==="password"){ - if(scope.default_password.trim() !== ""){ + if(scope.default_password && scope.default_password.trim() !== ""){ if(scope.default_password.trim().length < scope.password_min && scope.password_min !== "" ){ scope.minTextError = true; } @@ -293,7 +293,7 @@ export default } } - if(scope.type.type==="multiselect" && scope.default_multiselect.trim() !== ""){ + if(scope.type.type==="multiselect" && scope.default_multiselect && scope.default_multiselect.trim() !== ""){ choiceArray = scope.choices.split(/\n/); answerArray = scope.default_multiselect.split(/\n/); @@ -306,7 +306,7 @@ export default } } - if(scope.type.type==="multiplechoice" && scope.default.trim() !== ""){ + if(scope.type.type==="multiplechoice" && scope.default && scope.default.trim() !== ""){ choiceArray = scope.choices.split(/\n/); if($.inArray(scope.default, choiceArray)===-1){ scope.invalidChoice = true;