diff --git a/awx/ui/client/src/templates/prompt/prompt.controller.js b/awx/ui/client/src/templates/prompt/prompt.controller.js
index 362e1223fe..2f7baae551 100644
--- a/awx/ui/client/src/templates/prompt/prompt.controller.js
+++ b/awx/ui/client/src/templates/prompt/prompt.controller.js
@@ -158,6 +158,13 @@ export default [ 'Rest', 'GetBasePath', 'ProcessErrors', 'CredentialTypeModel',
order: order
};
order++;
+
+ let codemirror = () => {
+ return {
+ validate:{}
+ };
+ };
+ vm.codeMirror = new codemirror();
}
if(vm.promptDataClone.launchConf.survey_enabled) {
vm.steps.survey.includeStep = true;
@@ -189,6 +196,16 @@ export default [ 'Rest', 'GetBasePath', 'ProcessErrors', 'CredentialTypeModel',
};
vm.next = (currentTab) => {
+ if(_.has(vm.steps.other_prompts, 'tab._active') && vm.steps.other_prompts.tab._active === true){
+ try {
+ if (vm.codeMirror.validate) {
+ vm.codeMirror.validate();
+ }
+ } catch (err) {
+ event.preventDefault();
+ return;
+ }
+ }
Object.keys(vm.steps).forEach(step => {
if(vm.steps[step].tab) {
if(vm.steps[step].tab.order === currentTab.order) {
diff --git a/awx/ui/client/src/templates/prompt/prompt.partial.html b/awx/ui/client/src/templates/prompt/prompt.partial.html
index 820ea8553d..e336f35744 100644
--- a/awx/ui/client/src/templates/prompt/prompt.partial.html
+++ b/awx/ui/client/src/templates/prompt/prompt.partial.html
@@ -19,7 +19,7 @@
diff --git a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js
index 96a087218d..71af177f87 100644
--- a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js
+++ b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js
@@ -5,7 +5,7 @@
*************************************************/
export default
- ['ParseTypeChange', 'CreateSelect2', 'TemplatesStrings', '$timeout', function(ParseTypeChange, CreateSelect2, strings, $timeout) {
+ ['ParseTypeChange', 'CreateSelect2', 'TemplatesStrings', '$timeout', 'ToJSON', function(ParseTypeChange, CreateSelect2, strings, $timeout, ToJSON) {
const vm = this;
vm.strings = strings;
@@ -79,8 +79,15 @@ export default
codemirrorExtraVars();
}
});
+
+ function validate () {
+ return ToJSON(scope.parseType, scope.extraVariables, true);
+ }
+ scope.validate = validate;
};
+
+
vm.toggleDiff = () => {
scope.promptData.prompts.diffMode.value = !scope.promptData.prompts.diffMode.value;
};
diff --git a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js
index c551fc8bd7..3a4990ae10 100644
--- a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js
+++ b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js
@@ -12,7 +12,8 @@ export default [ 'templateUrl',
scope: {
promptData: '=',
otherPromptsForm: '=',
- isActiveStep: '='
+ isActiveStep: '=',
+ validate: '='
},
templateUrl: templateUrl('templates/prompt/steps/other-prompts/prompt-other-prompts'),
controller: promptOtherPrompts,