mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Merge pull request #10335 from mabashian/10129-multi-choice-survey
Properly validate multiple choice survey questions SUMMARY link #10129 In action: ISSUE TYPE Bugfix Pull Request COMPONENT NAME UI Reviewed-by: Kersom <None>
This commit is contained in:
commit
49eccfb19f
@ -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 (
|
||||
|
||||
@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user