rshinyshinyalert

How I can use tag-list box html in shinyalert?


I use shinyalert and I want to put inside tag-list box when I use HTML, but it doesn't work

shinyalert(
      type = "info",
      confirmButtonText = "close",
      confirmButtonCol = "#6DBADE",
      size = "l", 
      closeOnEsc = TRUE,
      closeOnClickOutside = TRUE,
      animation = TRUE,
      html = TRUE,
      text =  HTML("
             <form action=''>
             <input list='cars'>
             <datalist id='cars'>
             <option value='BMW' />
             <option value='Bentley' />
             </datalist>
             </form>") 
    )

any idea where is my problem?


Solution

  • First, remove HTML.

    Now, I don't know why, but the css .sweet-alert input has the property display: none;.

    So you can do: <input list='cars' style='display: block;'/>.


    EDIT

    However, the dropdown does not work. You can do this instead:

      shinyalert(
        type = "info",
        confirmButtonText = "close",
        confirmButtonCol = "#6DBADE",
        size = "l", 
        closeOnEsc = TRUE,
        closeOnClickOutside = TRUE,
        animation = TRUE,
        html = TRUE,
        text = selectInput("slct", label = NULL, choices = c("BMW", "Honda"))
      )