From 7a3382dd76da3a04c560e681bfb5b435ab587782 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 9 Dec 2020 11:01:40 -0500 Subject: [PATCH] Fix initial multiplechoice survey question value when no default present. --- .../src/components/LaunchPrompt/steps/useSurveyStep.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx index 05719ad3a7..37e5454d13 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx @@ -111,8 +111,11 @@ function getInitialValues(launchConfig, surveyConfig, resource) { values[`survey_${question.variable}`] = question.default ? question.default.split('\n') : []; + } else if (question.type === 'multiplechoice') { + values[`survey_${question.variable}`] = + question.default || question.choices.split('\n')[0]; } else { - values[`survey_${question.variable}`] = question.default || null; + values[`survey_${question.variable}`] = question.default || ''; } if (resource?.extra_data) { Object.entries(resource.extra_data).forEach(([key, value]) => {