diff --git a/R/shinyform.R b/R/shinyform.R index 4eec78e..dd9145b 100644 --- a/R/shinyform.R +++ b/R/shinyform.R @@ -344,6 +344,11 @@ formServerHelper <- function(input, output, session, formInfo) { write.csv(loadData(formInfo$storage), file, row.names = FALSE) } ) + return( + reactive({ + input$submit + }) + ) } createFormInfo <- function(id, questions, storage, name, multiple = TRUE, diff --git a/README.md b/README.md index 1eb2659..474eae6 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,16 @@ shinyApp(ui = ui, server = server) Of course you could put more stuff in the app, but this is the beauty of it, the form is a "module" that you can just plug into any Shiny app anywhere you want. Every time you submit a response, it will be saved as a file in the `responses` directory. This example is the most basic usage. +Additionally, `formServer` may be used like a reactive function that sends a signal when the form is submit. This is useful for refreshing tables after a form is filled out. + +```r +trigger <- formServer(basicInfoForm) +output$my_table <- renderDataTable({ + trigger() + mtcars +}) +``` + #### Current features - Responses are saved to local files