Revisiting Shiny.setInputValue in modular app with namespaces

I wanted to follow up @TomStewart's post Shiny.setInputValue in modular app with namespaces and trying to design a repex to showcase the example but I must be missing something:

An app with a module that simply prints the custom shiny input (right now it's printing NULL when I expect it to be printing This is a test)


customInputUI <- function(id) {
  ns <- NS(id)

# Render the custom shiny input binding
customInput <- function(input, output, session) {
  # This should return "This is a test" from script.js....?
  # output$debug <- renderPrint({ input$testing })
  output$debug <- renderPrint({ input$testing })

ui <- fixedPage(
  h2("Shiny.setInputValue Inside Module"),
  # This is where we assign the custom binding
  tags$script(src = "script.js")

server <- function(input, output, session) {
  df <- callModule(customInput, "custom_input")

shinyApp(ui, server)

The JS file to create the custom input (script.js):

Shiny.setInputValue('testing', "This is a test");

in the link to setting inputValues the reply says "To reference an input id via setInputValue in a modular app that uses namespaces, simply add the namespace id in front of the input id, separated by a dash", I don't see a namespace ID & input IDseparated by a dash, but I haven't replicated the issue. Good luck

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.