Skip to content

Instantly share code, notes, and snippets.

@wch
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wch/9671313 to your computer and use it in GitHub Desktop.
Save wch/9671313 to your computer and use it in GitHub Desktop.
submitButton demo app for R Shiny

When a submitButton is present in a Shiny application, it causes all the inputs on the page to not send updates to the server until the button is pressed.

In most cases, it is best not to use submitButton, but instead to use actionButton, since it allows finer-grained control over which inputs will trigger re-execution of code. See the actionButton demo in the gallery for more information.

Type: Shiny
Title: submitButton demo
License: MIT
Author: Winston Chang <winston@rstudio.com>
AuthorUrl: http://www.rstudio.com/
Tags: submitbutton
DisplayMode: Showcase
shinyServer(function(input, output) {
output$plot1 <- renderPlot({
hist(rnorm(input$n))
})
output$text <- renderText({
paste("Input text is:", input$text)
})
})
shinyUI(fluidPage(
titlePanel("submitButton example"),
fluidRow(
column(3, wellPanel(
sliderInput("n", "N:", min = 10, max = 1000, value = 200,
step = 10),
textInput("text", "Text:", "text here"),
submitButton("Submit")
)),
column(6,
plotOutput("plot1", width = 400, height = 300),
verbatimTextOutput("text")
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment