R/update-shiny-material-password-box.R

Defines functions update_material_password_box

Documented in update_material_password_box

#' Change the value of a material_password_box on the client
#'
#' Change the value of a material_password_box on the client.
#' @param session The session object passed to function given to shinyServer.
#' @param input_id The input_id of the material_password_box.
#' @param value The value to set for the material_password_box.
#' @seealso \code{\link{material_password_box}}
#' @examples
#' \dontrun{
#' update_material_password_box(
#'   session,
#'   input_id = "example_password_box",
#'   value = "New Password"
#' )
#' }
update_material_password_box <- function(session, input_id, value = NULL){
  if(is.null(value)) {
    return(NULL)
  }
  session$sendCustomMessage(
    type = "shinymaterialJS",
    paste0(
        "$('#", input_id, "').val('", value, "');Shiny.onInputChange('", input_id, "', '", value, "');M.updateTextFields()"
    )
  )
}

Try the shinymaterial package in your browser

Any scripts or data that you put into this service are public.

shinymaterial documentation built on Sept. 1, 2020, 1:07 a.m.