2

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"))))
rezakhorshidi
  • 539
  • 1
  • 4
  • 10

1 Answers1

1

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')))
asosnovsky
  • 2,158
  • 3
  • 24
  • 41