r - How do I create a pop up box in Shiny to get input data, which then carries foward in my Shiny app? -


i have app want ask question front in pop dialogue box, have question answered, have box disappear, , have app run.

i have searched on week , have tried many things no avail. have tried readline(). have looked @ shinybs none of examples functioning. have looked tcltk2. while didn't errors, nothing happened include no dialogue box.

here simple example of do.

suppose want pop box ask, name?

after name inputed, box closes, , app begins. perhaps app says, hello name.

please me update code below.

library(shiny) library(tcltk2) library(shinybs)  #create pop box asking name. substitute value xxx below. ui <- shinyui(fluidpage(     # application title    titlepanel("hello xxx, how you?")      ) )  server <- shinyserver(function(input, output) {      })   # run application  shinyapp(ui = ui, server = server) 

for completeness, here code wrote. gleaned link pork chop referenced. works, although parts still don't understand.

library(shiny)  logged = false;  ui1 <- function(){   taglist(     div(id = "login",         wellpanel(textinput("name", "name"),                   br(),actionbutton("submit", "submit"))),     tags$style(type="text/css", "#login {font-size:10px;   text-align: left;position:absolute;top: 40%;left: 50%;margin-top: -100px;margin-left: -150px;}")   )}  ui2 <- function(){fluidpage(    # application title   titlepanel({     fluidrow(column(12,             textoutput("greeting")))               })  )}   ui = (htmloutput("page")) server = (function(input, output,session) {    user <- reactivevalues(logged = logged)    observe({      if (user$logged == false) {       if (!is.null(input$submit)) {         if (input$submit > 0) {           username <- isolate(input$name)           if (length(username) > 0 ) {              user$logged <- true            }         }        }     }       })   observe({     if (user$logged == false) {        output$page <- renderui({         div(class="outer",do.call(bootstrappage,c("",ui1())))       })     }     if (user$logged == true)      {       output$page <- renderui({         div(class="outer",do.call(fluidpage,ui2()))       })       print(ui)     }   })    output$greeting <- rendertext({     print(paste("hello, how you", " ", input$name,"?", sep = ""))     })  })  runapp(list(ui = ui, server = server)) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -