-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shinyjs::reset is not resetting passwordInput() inside module #78
Comments
Thank you for the very detailed report. Could you please send an example that is more minimal? Debugging the problem within such an involved app is going to be hard, it really helps if you isolate the problem. It'd also help to know if this is only happening inside modules or if it's a problem in general |
Sorry about that, here is a basic example that is non-modular (I ran it and it still does not work even as a non-modular app). App.R##TestUI.R
library(shiny)
library(shinyjs)
TestUI <- function(id){
# Define UI for application that draws a histogram
navbarPage("Test UI", inverse = TRUE,
tabPanel("Admin",
uiOutput("adminTab")
)
)
}
# Define server logic required to draw a histogram
Test <- function(input, output, session) {
output$adminTab <- renderUI({
fluidPage(
shinyjs::useShinyjs(),
fluidRow(
column(6, offset=1,
div(id = 'adminAdd',
textInput("userNameAdd", "Username:"),
passwordInput('passwdAdd', "Password:", value=""),
selectInput("privsAdd", "Privileges:", c(" ", "Admin" = "Admin", "Guest" = "Guest")),
br(),
actionButton("AddUser", "Create", class = "btn-primary")
))))
})
observeEvent(input$AddUser, {
tryCatch({
shinyjs::reset("adminAdd")
})
})
}
shinyApp(ui = TestUI, server = Test) |
Thank you. That really makes it a lot easier to debug the problem :) On 20 August 2016 at 08:17, shinyuser [email protected] wrote:
|
After scouring the internet to see if anyone else has ran into this problem, I finally decided to turn to this. Here is the problem: I have a shiny form. Said shiny form is built to gather data from a user and send the results to a MySQL database to create users. The form takes textInput() for a username, passwordInput() for a password, and then selectInput() for assigning permissions to the user (Admin or Guest). After the user submits the form, the UI shows a thank you message, resets the form using shinyjs::reset, hides the form, and a link back to the form will display a blank form again. Except the password field which contains the data that was previously entered. I have tried inserting raw HTML to mimic the textInput() field, which I will include below, but that also did not work. I'm relatively new to shiny, so sorry if it looks clunky.
Here is some version info:
Here is the html code I manually inserted with Chrome developer tools:
Here is the html code that does reset for the textInput() field:
The App.R and UserDB.R files are below. Thanks!
App.R
UserDB.R
The text was updated successfully, but these errors were encountered: