I am new to Shiny but already find it most interesting fo rapid GUI development.
I am trying to get the following: I basically have two textInputs. When the first is changed, I would like the second one to be automatically updated with some new value (not using any actionButton), and the other way around too. But I am getting an infinite loop.
A simple example where updating means adding one is:
server.r
library(shiny)
shinyServer(function(input, output,session) {
observe({
newval = as.numeric(input$field1)+1
updateTextInput(session,"field2",value=newval)
})
observe({
newval = as.numeric(input$field2)+1
updateTextInput(session,"field1",value=newval)
})
})
ui.R
library(shiny)
shinyUI(basicPage(
textInput("field1", "Field 1", ""),
textInput("field2", "Field 2", "")
))
I tried to encapsulate 'input$field1' and 'input$field2' within a call to isolate() but this does not solve the problem.
Any suggestion? Many thanks in advance,
Yvonnick