1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Job submission for optional survey questions

Make sure optional multiselect and multiplechoice answers are ignored if not answered
This commit is contained in:
Jared Tabor 2015-02-19 12:59:09 -05:00
parent 0286800ead
commit db8eed2ae5

View File

@ -77,7 +77,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
for (var i=0; i < scope.survey_questions.length; i++){
var fld = scope.survey_questions[i].variable;
// 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];
}
// 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"){
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) : "";
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
html+='<textarea id="'+question.variable+'" name="'+question.variable+'" ng-model="'+question.variable+'" '+