Skip to content

Commit

Permalink
validateSelected() does not validate selected for the optgroup case…
Browse files Browse the repository at this point in the history
…; this function is only for shiny <= 0.9
  • Loading branch information
yihui committed Jul 11, 2014
1 parent 721b26f commit fe3158f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/bootstrap.R
Expand Up @@ -616,11 +616,11 @@ checkboxGroupInput <- function(inputId, label, choices, selected = NULL, inline
validateSelected <- function(selected, choices, inputId) {
# drop names, otherwise toJSON() keeps them too
selected <- unname(selected)
if (is.list(choices)) {
# <optgroup> is not there yet
if (any(sapply(choices, length) > 1)) return(selected)
choices <- unlist(choices)
}
# if you are using shiny > 0.10.0, you are supposed to know that `selected`
# must be a value instead of a label
if (needOptgroup(choices)) return(selected)
if (is.list(choices)) choices <- unlist(choices)

nms <- names(choices)
# labels and values are identical, no need to validate
if (identical(nms, unname(choices))) return(selected)
Expand Down

0 comments on commit fe3158f

Please sign in to comment.