I am trying to create an interactive UI, which asks for more details as the user interacts with it. I have added a bsButton, which is supposed to insert more input options to collect more details, but the button is not inserting the UI when it is clicked. Any help or recommendations for the code? Thanks in advance.
ui <- shinyUI( #UI
dashboardPage(
fluidPage(
fluidRow(
introBox(
bsButton("pricing_request", #button to insert UI to collect more details
label = "Pricing Request",
icon = icon("car-battery"),
style = "success")
)))))
#serverpart
server <- function(input, output, session) {
observeEvent(input$pricing_request,{
insertUI(
selector = "#add",
where = "afterEnd",
ui = box( #UI to be inserted
bootstrapPage(
div(style="float:right", actionButton("add_request",
label = "add option",
icon = icon("plus"),
style = "arial")),
div(style="display:inline-block",
textInput(
inputId = "option_1",
label = "Option",
width = '350px',
value = "insert option"))))
)})}
By writing
you request to add an UI after the HTML element whose id is
add
. But there's no such element in your app. If you adddiv(id = "add")
somewhere in your app, that should work.