diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx index 0c84e829be..e4d0782218 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx @@ -92,7 +92,10 @@ function NumberField({ question }) { } function MultipleChoiceField({ question }) { - const [field, meta] = useField(`survey_${question.variable}`); + const [field, meta] = useField({ + name: `survey_${question.variable}`, + validate: question.required ? required(null) : null, + }); const id = `survey-question-${question.variable}`; const isValid = !(meta.touched && meta.error); return ( diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx index b02d7524aa..ab535fa8ab 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx @@ -10,7 +10,6 @@ export default function useSurveyStep( launchConfig, surveyConfig, resource, - visitedSteps ) { const { setFieldError, values } = useFormikContext(); @@ -137,7 +136,7 @@ function checkForError(launchConfig, surveyConfig, values) { hasError = true; } } - if (question.required && !value && value !== 0) { + if (question.required && (!value || value.length === 0)) { hasError = true; } });