fixed duplicate choices from being passed to select2

This commit is contained in:
John Mitchell 2015-09-03 12:19:42 -04:00
parent 5f6f16b5ff
commit b38615eff7

View File

@ -434,6 +434,11 @@ export default
}
data.choices = (scope.type.type === "multiplechoice") ? scope.choices : (scope.type.type === 'multiselect') ? scope.choices : "" ;
if (data.choices !== "") {
// remove duplicates from the choices
data.choices = _.uniq(data.choices.split("\n")).join("\n");
}
Wait('stop');
if(scope.mode === 'add' || scope.mode==="edit" && scope.can_edit === true){
$('#survey-save-button').removeAttr('disabled');