Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateselectinput docs on UI input variables with special characters #3900

Closed
nick-youngblut opened this issue Sep 22, 2023 · 3 comments
Closed

Comments

@nick-youngblut
Copy link

For a number of reasons, I want to use UI input variables that include special characters (e.g., Project ID instead of Project_ID). However, it appears that updateselectinput does not work in such cases (e.g., updateSelectInput(session, "plot type", choices = new_choices)). It would be helpful to include such a warning in the updateselectinput docs.

@cpsievert
Copy link
Collaborator

cpsievert commented Sep 26, 2023

Interesting, thanks! This behavior seems to be specific to Chrome (I'm on v16.0.5845.187), and applies to both selectInput(selectize = T/F). See below for a minimal reprex and notice how Project ID becomes ProjectID and Other Choice becomes Other choice (even though the <option> HTML sent to the client has the proper, user-supplied, values)

library(shiny)

ui <- fluidPage(
  selectInput("x", NULL, choices = c("Foo", "Bar"), selectize = FALSE),
  verbatimTextOutput("out")
)

server <- function(input, output, session) {  
  updateSelectInput(inputId = "x", choices = c("Project ID", "Other Choice"))
  output$out <- renderPrint(input$x)
}

shinyApp(ui, server)

@gadenbuie
Copy link
Member

If this issue is about the select inputId being "plot type", then #3852 will probably fix the original issue.

But it sounds like there's a separate issue with the handling of choices.

@cpsievert
Copy link
Collaborator

Oh interesting, the problem I mentioned in #3900 (comment) goes away if I select "Never translate this page" (it's trying to translate to Arabic?!?)

Anyway, it's not clear what Shiny can do to help the situation without any more details, so I'll be closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants