I have an app wherein users can input numeric values for certain fields (using numericInput()
). Alternatively, they can choose to select values from a reference table (via a checkboxInput()
field).
I'm able to code this behaviour in the script properly. But I also want that if the checkboxInput
field is selected, the values displayed in the numericInput()
get updated i.e. the default values or previously written values are overwritten.
In the screenshot, the numericInput
fields are highlighted in yellow. The top field has a default value of 14 whereas the others are empty. I want that the if the "Copy reference values?" checkboxInput
is selected, the copied values get displayed in the corresponding fields (k1 = 72.49 for "Flow Coef. for dP" etc.)
My code is as below:
fluidRow(
column(4,
numericInput(inputId = "Area",
label = tags$div(HTML(paste("rea (m", tags$sup(2), ")", sep = ""))),
min = 1, max = 100, step = 0.1, value = 14),
numericInput(inputId = "k1", label = "Flow coef. for dP", min = 1.0, max = 600.0, value = ""),
numericInput(inputId = "k2", label = "Flow exponent for dP" , min = 1.0, max = 20.0, value = "")
checkboxInput("copyVals", "Copy Reference Values?", value = FALSE)
)