mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Job submission for optional survey questions
Make sure optional multiselect and multiplechoice answers are ignored if not answered
This commit is contained in:
@@ -77,7 +77,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
for (var i=0; i < scope.survey_questions.length; i++){
|
for (var i=0; i < scope.survey_questions.length; i++){
|
||||||
var fld = scope.survey_questions[i].variable;
|
var fld = scope.survey_questions[i].variable;
|
||||||
// grab all survey questions that have answers
|
// grab all survey questions that have answers
|
||||||
if(scope[fld]) {
|
if(scope.survey_questions[i].required || (scope.survey_questions[i].required === false && scope[fld].toString()!=="")) {
|
||||||
job_launch_data.extra_vars[fld] = scope[fld];
|
job_launch_data.extra_vars[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
// for optional text and text-areas, submit a blank string if min length is 0
|
// for optional text and text-areas, submit a blank string if min length is 0
|
||||||
@@ -544,7 +544,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(question.type === "textarea"){
|
if(question.type === "textarea"){
|
||||||
scope[question.variable] = question.default || question.default_textarea;
|
scope[question.variable] = (question.default_textarea) ? question.default_textarea : (question.default) ? question.default : "";
|
||||||
minlength = (!Empty(question.min)) ? Number(question.min) : "";
|
minlength = (!Empty(question.min)) ? Number(question.min) : "";
|
||||||
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
|
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
|
||||||
html+='<textarea id="'+question.variable+'" name="'+question.variable+'" ng-model="'+question.variable+'" '+
|
html+='<textarea id="'+question.variable+'" name="'+question.variable+'" ng-model="'+question.variable+'" '+
|
||||||
|
|||||||
Reference in New Issue
Block a user