Inconsistency with selectInput when choices=NULL in regards of multiple parameter

12 views
Skip to first unread message

Raphael N

unread,
Aug 24, 2016, 11:57:58 AM8/24/16
to Shiny - Web Framework for R
Hello everyone,

I have two selectInput. One with multiple = TRUE and one with multiple = FALSE. Both of them have the choices parameter equals to NULL.
With the one input with multiple=TRUE, the input value is NULL.
With the other one, it forces it to "".

I have been in the code under it and it seems that in that case shiny:::selectizeIt will always put the argument nonempty to TRUE and so the value will be forced to "".
Is there a way to force having a NULL value ?


Here is a code to demonstrate this issue :


library(shiny)

ui <- fluidPage(
  column(6,
         selectInput(inputId = "input1",
                     label = "input1",
                     choices = NULL,
                     selected = NULL,
                     multiple = FALSE
                     ),
         verbatimTextOutput("output1")
  ),
  column(6,
         selectInput(inputId = "input2",
                     label = "input2",
                     choices = NULL,
                     selected = NULL,
                     multiple = TRUE
                     ),
         verbatimTextOutput("output2")
  )
)


server <- shinyServer(function(input, output, session){
  output$output1 <- renderPrint(
    list(choices = input$input1,
         is.null = is.null(input$input1),
         length = length(input$input1))
  )
  output$output2 <- renderPrint(
    list(choices = input$input2,
         is.null = is.null(input$input2),
         length = length(input$input2))
  )
})

shinyApp(ui, server)


Thanks
Reply all
Reply to author
Forward
0 new messages