I do not know how to reset my UI using code. After I fill the parameters in UI, I want to reset it to the original state with empty values. Currently, I have to turn off and relaunch it to achieve this purpose. I plan to reset input$*** values to do it. But I find that input$*** values cannot be modified.
The detail please see this poster
HI @yu.cai.tch . Like you, I thought shinyjs would offer a solution, but according to the documentation for the reset() function, action buttons are not supported. One way I've handled this before is by introducing a reactiveVal that serves as the button counter (input_button_value in example below). Every time the submit button is clicked, the reactiveVal increases by 1. When the reset button is clicked, the reactiveVal is set to 0. Then, any place in the app I would want to use the counter value of the submit button, I would refer to this reactiveVal.
I reworked the sample app you provided to illustrate this concept below.
library(shiny)
library(shinyjs)
ui <- fluidPage(
actionButton("…
system
Closed
February 9, 2024, 5:38pm
2
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.