dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
834 stars 153 forks source link

Output of virtualSelectInput does not handle special characters properly #710

Closed joeramirez closed 1 month ago

joeramirez commented 1 month ago

I believe this is a similar/same issue as #6 , but when the virtualSelectInput choices contain items with special characters ('&' for example), the resulting output when those items are selected come out with URL encoding (ie, '&).

shinyWidgets package version: 0.8.7 shiny package version: 1.9.1 R version: 4.4.1

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      virtualSelectInput(
        inputId = "test",
        label = "Test",
        choices = c("Oranges", "Berries", "Peaches & Plums", "Apples & Bananas"),
        multiple = T
      )
    ),
    mainPanel(
        textOutput("myOutput"),
      )
  )
)

server <- function(input, output) {

  output$myOutput <- renderText({
    paste0(input$test, collapse = " | ")
  })
}

shinyApp(ui = ui, server = server)
pvictor commented 1 month ago

Hello, You have to use html = TRUE otherwise special characters in HTML are escaped.

Victor

joeramirez commented 1 month ago

Of course!! Sorry - didn't see that option somehow. Thank you!