Fixed bug where optional single select survey questions with a default value couldn't be skipped

This commit is contained in:
Michael Abashian 2017-04-10 17:13:42 -04:00
parent f0102ef0ff
commit 9a678c72dc
2 changed files with 10 additions and 3 deletions

View File

@ -42,6 +42,13 @@ export default
else if(question.type === "multiplechoice") {
question.model = question.default ? angular.copy(question.default) : "";
question.choices = question.choices.split(/\n/);
// Add a default empty string option to the choices array. If this choice is
// selected then the extra var will not be sent when we POST to the launch
// endpoint
if(!question.required) {
question.choices.unshift('');
}
}
else if(question.type === "float"){
question.model = (!Empty(question.default)) ? angular.copy(question.default) : (!Empty(question.default_float)) ? angular.copy(question.default_float) : "";

View File

@ -90,9 +90,9 @@ export default
// for optional select lists, if they are left blank make sure we submit
// a value that the API will consider "empty"
//
case "multiplechoice":
job_launch_data.extra_vars[fld] = "";
break;
// ISSUE: I don't think this logic ever actually fires
// When I tested this, we don't pass this extra var back
// through the api when the mutliselect is optional and empty
case "multiselect":
job_launch_data.extra_vars[fld] = [];
break;