2
votes

Can someone please help me with the following shiny problem: I need to make a conditional panel, but here I don't want it to appear unless someone chooses Female. When I run this code, however, the conditionalPanel appears in the page. Any help will be much appreciated ...

selectInput("gender", 
            "What is your gender?", 
            choices = c(Male="Male", Female="Female")),
conditionalPanel(condition = "input.gender=='Female'", 
                 selectInput("cond_sel",  
                             "Are you pregnant?", 
                             c("Yes", "No"))))
1
Strange, it should not appear unless Female is selected.Stéphane Laurent

1 Answers

1
votes

try

selectInput("gender", 
            "What is your gender?", 
            choices = c(Male="Male", Female="Female"),selected='Male'),
conditionalPanel(condition = "input.gender=='Female'", 
                 selectInput("cond_sel",  
                             "Are you pregnant?", 
                             c("Yes", "No"),selected='No')))