From ea4b435ea7513745f41595ff59af18f7adc7abf3 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 1 Jul 2020 11:59:05 -0400 Subject: [PATCH] Ignore required field validation for booleans --- .../client/lib/components/input/base.controller.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/lib/components/input/base.controller.js b/awx/ui/client/lib/components/input/base.controller.js index eabd536e34..9a08ed0f2e 100644 --- a/awx/ui/client/lib/components/input/base.controller.js +++ b/awx/ui/client/lib/components/input/base.controller.js @@ -12,7 +12,13 @@ function BaseInputController (strings) { scope.state._touched = false; scope.state._required = scope.state.required || false; - scope.state._isValid = scope.state._isValid || false; + + if (scope.state.type === 'boolean') { + scope.state._isValid = scope.state._isValid || true; + } else { + scope.state._isValid = scope.state._isValid || false; + } + scope.state._disabled = scope.state._disabled || false; scope.state._activeModel = scope.state._activeModel || '_value'; @@ -59,6 +65,10 @@ function BaseInputController (strings) { scope.state._touched = true; } + if (scope.state.type === 'boolean') { + return { isValid, message }; + } + if (scope.state._required && (!scope.state._value || !scope.state._value[0]) && !scope.state._displayValue) { isValid = false;