jeudi 6 septembre 2018

Does anyone know how to change the color of error messages for only one output?

On my app, I want to change only the error message color for one part of my output. My error messages are currently coming up in blue because that is the way the regular output prints.

Here is the current code for the font color, (it does not work anymore since my error messages are made with "if" statements now rather than "validate"):

tags$head(
                           tags$style(".shiny-output-error{
                                           color: black; font-style: italic;}"))

                           )
),

here are the error messages:

  if(input$N_1     == "") {error_statement = 'Error. Fill in Sample Size for Group 1.'}
if(input$N_2     == "") {error_statement = 'Error. Fill in Sample Size for Group 2.'}
if(input$sigma_1 <= 0) {error_statement = 'Error. Standard devation 1 must be positive.'}
if(input$sigma_2 <= 0) {error_statement = 'Error. Standard deviation 2 must be positive.'}
if(input$N_1%%1  != 0) {error_statement = 'Error. Sample size 1 must be an integer.'}
if(input$N_2%%1  != 0) {error_statement = 'Error. Sample size 2 must be an integer.'}
if(input$N_1     <= 1) {error_statement = 'Error. Sample size 1 must be 1 or greater.'}
if(input$N_2     <= 1) {error_statemement = 'Error. Sample size 2 must be 1 or greater.'}

This is the part of the output that I want to change:

if(error == 1){
    output$Power = renderText({error_statement})

  }

I want the part that is "error statement" to be in black and be italicized.

This is how the output looks when an error happens

It is this color because when no error comes up, this is the color that the output should be. However, as previously mentioned, I want it to be black and italicized only when an error is made.

Does anyone know how to fix this?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire