Closed jono3030 closed 3 years ago
What you're seeing is the return value of calling shinyalert()
. A call to shinyalert()
returns a unique ID of that modal box. It's being printed out simply because it's the last statement inside the eventReactive(). For example, if you add 5
inside the eventReactive after the call to shinyalert, then you would see the text 5
printed out. I don't understand exactly what you're trying to achieve, but this has nothing to do with shinyalert, I think you may need to rethink the entire logic of how you're doing validation checks and printing messages. I suggest asking on an R/shiny online forum for help, since this is a general shiny question, not about shinyalert.
Thanks a lot @daattali for taking the time to respond and for your clear explanation! The returned value makes sense now and your answer helped me a lot with understanding this better. Apologies for posting here instead of going to the R/Shiny forums instead.
Thanks again!
Dear Dean,
First of all thanks for the awesome package!
I've got a question about using
shinyalert
with anactionButton
in anobserveEvent
->eventReactive
environment with validation. The validation checks andshinyalert
are part of the sameeventReactive
and as such share the samerenderText
function which is linked to atextOutput
box that displays the error messages returned by the validation checks. Clicking on the action button triggers the validation checks. If a check doesn't pass, an error message gets displayed in thetextOutput
. If everything passes, however, no error message from the validation checks gets displayed andshinyalert
gets triggered. The idea is that the function that gets triggered by theactionButton
only executes when all validation checks have passed.The problem is that triggering
shinyalert
also displays one of the following messages in thetextOutput
that it shares with the validation checks:These messages vary depending on the input entered by the user.
My question is if there is a way to suppress this output so that is doesn't show up when all validation checks have passed and the modal pops up?
I assume that the output is expected (auto generated object id's perhaps?) but I'm too much of a Shiny novice to understand where it is coming from or how to capture it. I tried to not include
shinyalert
in theeventReactive
but I couldn't find a way to keep the validity checks working. Anyway, it would be great if there was a way to suppress or control this output.Also, as I only started using Shiny a month ago or so I apologize in advance if I missed something obvious here and this is not actually a legitimate question.
In either case, here is a reproducible example:
Thanks a lot!