Let's say I have the following brilliant application:
library(shiny)
ui <- fluidPage(
column(3,
radioButtons("radios", "",
c("Enabled" = "enabled",
"Disabled" = "disabled"),
inline = TRUE)
),
column(4, textInput("text", "", value = "Disable me"))
)
server <- function(input, output) {
}
shinyApp(ui=ui, server=server)
What is the easiest way to disable textInputbased on the selected radio button? I know that I just need to add ... disabled />to the tag input, but I do not know how to do this in Shiny.
I tried to create the complete tag "manually" by inserting HTML as a string, the selected radio value and the rest of the HTML using uiOutputand renderUI(based on this ), but this did not work.
textInput generates this:
<input id="text" type="text" class="form-control" value="Disable me"/>
and I need to be able to switch between the above and the following:
<input id="text" type="text" class="form-control" value="Disable me" disabled />
source
share