title: How to display output text inside of input text box in Shiny?
body: <p>I am creating a shiny app where users can click on one of the cells of the 'renderDT' table to choose the text, and then this chosen text will be added into the text input box -- a function similar to when you type text on your phone, then the phone gives several candidate words for you to choose from. Then you can tap on one of the words, the word will automatically go to your text box, to finish your typing. </p>
  
  <p>I was able to find the example on how to get the clicked cell's value to the output from <a href="https://yihui.shinyapps.io/DT-proxy/" rel="nofollow noreferrer">here</a>. Something like this on 'server.R'</p>
  
  <pre><code>shinyServer(function(input, output,session) {
    output$inputecho &lt;- reactive({
      input$inputtext
    })
  
    candidates &lt;- reactive({
  
      candidates &lt;- data.table(
                   candidate=c("word1","word2","word3") 
                   score=c(0.2,0.13,0.12) 
                    ) ### here candidates is a dummy data with same ###structure of real data.
  
      candidates&lt;-as.data.frame(candidates)
      candidates
  
    })
  
  output$candidates&lt;-renderDT({candidates()},server=FALSE, selection = list(mode='single',target="cell"))
  
  observeEvent(input$candidates_cell_clicked,{
    info=input$candidates_cell_clicked
    if (is.null(info$value)||info$col!=0)return()
    updateTextInput(session,'inputtext',value=paste0(inputtext,info$value))
  })
  
   }
  )
  </code></pre>
  
  <p>And this for 'ui.R'</p>
  
  <pre><code>shinyUI(fluidPage(
  
      mainPanel(
  
        textInput("inputtext", label="", value=" "),
        p("Click to select from the top candidate words:"),
        DT::dataTableOutput("candidates")
        )
    ))
  </code></pre>
  
  <p>When I run the app, it seems that the cell can be shown as selected. However, the input text inside of my input textbox is not updated. 
  <a href="https://i.stack.imgur.com/9Dd4v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Dd4v.png" alt="screenshot of the app with cell selected"></a></p>