I would like to update the value of numericInput from selectInput and vice versa. I would like for the selectInput to change to "Other" as selected when any value is manually entered in numericInput. I would also like for the numericInput to update when "A","B" or "C" is selected from select input. I know that it's best to avoid circular references but I was wondering if this is doable. Here's what I have so far. The numeric input flashes briefly when "A", "B" or "C" is selected but it changes back to empty and the selected value changes back to other.
library(shiny)
if (interactive()) {
ui <- fluidPage(
selectInput(
"controller",
NULL,
c(
"A" = 35000,
"B" = 1200,
"C" = 12231,
"Other"
),selected = "Other"
),
numericInput("inNumber", "Input number", 0)
)
server <- function(input, output, session) {
observeEvent(input$controller, {
x <- input$controller
updateNumericInput(session, "inNumber", value = x)
})
observeEvent(input$inNumber,{
updateSelectInput(session,"controller",selected ="Other")
})
}
shinyApp(ui, server)
}
Thanks