insightsengineering / insightsengineering/teal
[Bug]: Validation messages should be separated by newline
- Dominant language
- R
- Stars
- 263
- Forks
- 59
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 5
Description
### What happened?
When there are multiple validation messages for the same input, they should be separated by new line.
Ideally, the solution should be done via CSS to avoid injecting more HTML
### In TMC
### Reproducible example
```r
ui <- shiny::fluidPage(
teal::use_validate_input_js(),
shiny::tags$div(
shiny::textInput("text1", "Label 1"),
shiny::textInput("text2", "Label 2"),
shiny::textInput("text3", "Label 3")
),
uiOutput("out")
)
server <- function(input, output, session) {
output$out <- shiny::renderUI({
shiny::validate(
teal::need_input(
inputId = c("text1", "text2"),
condition = !identical(input$text1, input$text2),
message = "Label 1 and Label 2 must be different"
),
teal::need_input(
inputId = c("text1", "text3"),
condition = !identical(input$text1, input$text3),
message = "Label 1 and Label 3 must be different"
),
teal::need_input(
inputId = c("text3", "text2"),
condition = !identical(input$text3, input$text2),
message = "Label 2 and Label 3 must be different"
)
)
shiny::tagList(
shiny::tags$p("All labels are different!"),
shiny::tags$p(paste("Label 1:", input$text1)),
shiny::tags$p(paste("Label 2:", input$text2)),
shiny::tags$p(paste("Label 3:", input$text3))
)
})
}
shiny::shinyApp(ui, server)
```
### sessionInfo()
```R
```
### Relevant log output
```R
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [x] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [x] I agree to follow this project's Security Policy.
Contributor guide
Assessment
This issue has not been assessed yet.