Trying to understand why this code is not working, keep in mind I am not even a JavaScript novice. The observeEvent does not even get triggered.
library(shiny)
library(shinyjs)
library(jsonlite)
ui <-
{
fluidPage(title = 'Title',
useShinyjs(),
actionButton(inputId = 'Button' , label = NULL),
textAreaInput(inputId = 'Input4', label = 'Test4'),
textInput(inputId = 'Input3', label = 'Test3')
)
}
server <- function(input, output, session) {
shinyjs::runjs(
'
var metadata = "{\"id\":[115],\"email\":[\"test_email_address\"]}";
Shiny.setInputValue("Input3", metadata);
'
)
observeEvent(input$Input3, ignoreInit = T, {
updateActionButton(inputId = 'Button', label = 'Success')
updateTextAreaInput(inputId = 'Input4', value = input$Input3)
})
}
shinyApp(ui = ui, server = server,
)
Correct escaping required