My code is here:
ui.R
shinyUI(fluidPage(
# Copy the line below to make a select box
selectInput("select", label = h3("Select box"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1),
numericInput("value",label="value", value=100),
hr(),
fluidRow(column(3, verbatimTextOutput("value")))
))
server.R
server=shinyServer(function(input, output) {
output$inputs=renderUI({
if(input$select =="1"){
numericInput(inputId = paste0("value",1),"1",100)
} else if(input$select=="2"){
numericInput(inputId ="value","value",100),
numericInput(inputId ="value","value",200),
numericInput(inputId ="value","value",300)
}
})
# You can access the value of the widget with input$select, e.g.
output$value <- renderPrint({ input$select })
})
This is a very simple case and the ui is like:
What I expect is that if I select "Choice 2", ui would give me this:
So how I can achieve my expectation?