Reputation: 55
I'm making a shiny app that takes a numericInput(size,...)
and displays a data frame of random numbers with input$size
rows, and then saves it as a csv. I'm looking for some way to prevent the user of the app to change the inputed number once they have provided it. For example, if the user sees the data frame and thinks "Oh, I don't like these numbers", I want to make sure they cannot just keep entering numbers until they get a result they want (without closing and reopening the app). Is there someway to fix the first input as it is given? Thank you so much!
Upvotes: 0
Views: 144
Reputation: 5003
You can use a combination of reactiveValue
and observeEvent
with the parameter once = TRUE
This will allow the reactiveValue to only be set once. The user can then change the input but it will have no effect on the rest of the app
size <- reactiveVal()
observeEvent(input$size,{
size(input$size)
},
once = TRUE)
You might have to look into the parameters ignoreInit
and ignoreNULL
depending on how you initate your numericInput.
Upvotes: 1