title: Shiny R renderPrint in loop usinf RenderUI only update the output
body: <p>I am trying to dynamically render multiple text output from multiple text input. I tried to use <a href="https://stackoverflow.com/questions/26931173/shiny-r-renderplots-on-the-fly">this very helpfull example</a> and <a href="https://stackoverflow.com/questions/15875786/dynamically-add-plots-to-web-page-using-shiny">this one too</a>.
  This <a href="https://github.com/rstudio/shiny/issues/532" rel="nofollow noreferrer">conversation </a> is also helpfull.
  But when I try to adapt this examples on the following script, I have a problem of output update. Apparently, only the last element was read and updated. It's probably a reactivity problem but it seems to be difficult to associate <code>reactive{()}</code> and <code>renderUI{()}</code>functions.</p>
  
  <pre><code>rm(list = ls())
  library(shiny)
  
  creatDataElem &lt;- function(ne, input) {
      x1 &lt;- lapply(1:ne, function(i) {
      textInput(paste0("elemName", i),
            label = h4(strong("Name of dataset element")),
            value = "")
     })
     return(x1)
  }
  
  ui = (fluidPage(
           sidebarLayout(
             sidebarPanel(
               sliderInput("elemNb",
                           "Number of elements", value = 1, min = 1,
                           max = 3)
               ,
               conditionalPanel(
                 condition = "input.elemNb == 1",
                 creatDataElem(1)
               ),
               conditionalPanel(
                 condition = "input.elemNb == 2",
                 creatDataElem(2)
               ),
               conditionalPanel(
                 condition = "input.elemNb == 3",
                 creatDataElem(3)
               )
             ),
           mainPanel(
             uiOutput("nameElem")
           )
         )
        )
     )
  
  server = function(input, output, session) {
  
  max_elem &lt;- 3
  # Name
  
  output$nameElem &lt;-renderUI({
    nameElem_output_list &lt;- lapply(1:input$elemNb, function(i) {
      elemName &lt;- paste0("elemName", i)
      tags$div(class = "group-output",
               verbatimTextOutput(elemName)
      )
    })
    do.call(tagList, nameElem_output_list)
  })
  
  for (i in 1:max_elem) {
    local({
      force(i)
      my_i &lt;- i
      elemName &lt;- paste0("elemName", my_i)
      output[[elemName]] &lt;- renderPrint(input[[elemName]])
    })
  }
  }
  
  runApp(list(ui = ui, server = server))
  </code></pre>
  
  <p>The idea with a <code>reactive({})</code> function is to add an independant object (a function in this case) like:</p>
  
  <pre><code>nameElem &lt;- reactive({
    if (input$goElem == 0) {
      return()
    } else {
      isolate({
        if (is.null(input$elemName)) {
           return()
        } else if (test(input$elemName)) {
           return("TEST RESULT")
        } else {
           return(input$elemName)
        }
     })
   }
  })
  </code></pre>
  
  <p>and to use <code>renderUI</code> on this object (with an <code>ActionButton</code>).
  So, if someone knows why the output does not return the good object...</p>