Tweaked previous commit to work properly for inputs that allow multiple selections.