Hi, I'm trying to put together a shiny application and add javascript. After spending hours researching the web I give up, I have not the remotest idea of how javascript works with R. I do not understand how I can communicate between elements of one language to another and less how I could change values or attributes of example a sliderInput
from javascript.
I would like someone in your vendita kindness and wisdom to enlighten me with this issue as I see it very complex.
Obviously this question has very broad answers and it would be a question worthy of closure therefore, I will give you an example (which still lacks logic) that could help me understand how to use R with javascript.
shinyApp(
ui = fluidPage(
textInput("txt", "Content", "Text of message"),
radioButtons("eliminar", "eliminar texto",
choices = c("Si", "no"),
inline = TRUE)
),
server = function (input,output){
}
)
Let's say we have something like that. According to this I would like a couple of things.
- At the moment we focus on
textInput
javascript what you will do is check if the text is empty, if not empty it until the next time you focus ontextinput
. - In the radio buton if it is selected, it will allow the function of the first point to work, if it does not appear a
alert
that says that this option is not activated.
It may seem a bit silly example (since it does not need js to work) but what really interests me is to be able to apply js events (onclick, onchange, onfocus ...) to any element of R.
I hope I have explained myself well as to what I am looking for.