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

multiple_radio() with a single choice #427

Open
MHaringa opened this issue Dec 7, 2022 · 1 comment
Open

multiple_radio() with a single choice #427

MHaringa opened this issue Dec 7, 2022 · 1 comment

Comments

@MHaringa
Copy link

MHaringa commented Dec 7, 2022

Thanks for awesome package. It appears that multiple_radio() returns NULL in case only one choice is defined as argument. See the example below. I would expect that multiple_radio() returns "A" in the following example:

# Checkbox
library(shiny)
library(shiny.semantic)

ui <- function() {
  shinyUI(
    semanticPage(
      h1("Radioboxes"),
      multiple_radio("radioboxes", "Select Letter", LETTERS[1], selected = "A"),
      p("Selected letter:"),
      textOutput("selected_letter")
    )
  )
}

server <- shinyServer(function(input, output) {
  output$selected_letter <- renderText( input$radioboxes )
})

shinyApp(ui = ui(), server = server)

A possible work around is the following, however multiple_radio() returning "A" instead of NULL seems more obvious to me.

server <- shinyServer(function(input, output) {
  output$selected_letter <- renderText( ifelse(is.null( input$radioboxes ),
                                               "A", input$radioboxes))
})
@Arlisaha
Copy link

Arlisaha commented Dec 8, 2022

+1

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

2 participants