Skip to content

Commit

Permalink
clear the UI after successful Save
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarneytu committed Apr 17, 2023
1 parent 49dcf66 commit 2de475a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions R/editSite.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ populateFields <- function(site) {
updateNumericInput(inputId = "longEntered", value = site$long)
}

resetEditUI <- function() {
updateTextInput(inputId = "user_site_id", value = "")
updateTextInput(inputId = "site_name", value = "")
updateTextInput(inputId = "contact_name", value = "")
updateTextInput(inputId = "contact_email", value = "")
updateDateInput(inputId = "install_date", value = "")
updateTextAreaInput(inputId = "equipment", value = "")
updateTextInput(inputId = "landowner", value = "")
updateTextAreaInput(inputId = "notes", value = "")
updateNumericInput(inputId = "latEntered", value = "")
updateNumericInput(inputId = "longEntered", value = "")
}

editSiteServer <- function(id, gageSites, selectedSite) {
moduleServer(id, function(input, output, session) {
stopifnot(is.reactive(gageSites))
Expand All @@ -114,6 +127,7 @@ editSiteServer <- function(id, gageSites, selectedSite) {
tryCatch({
updateSite(selectedSite()$site_id, input)
gageSites(loadSites())
resetEditUI()
showNotification("Site saved successfully.", type = "message")
},

Expand Down

0 comments on commit 2de475a

Please sign in to comment.