updateTextareaInput: updateTextareaInput

Description Usage Arguments Details Examples

Description

Set the value of a textarea on a shiny application UI.

Usage

1
updateTextareaInput(session, inputId, label = NULL, value = NULL)

Arguments

session

The session object passed to function given to shinyServer.

inputId

The id of the input object.

label

The label to set for the input object

value

The value to set for the input object.

Details

Although a textareaInput doesn't exist in shiny it is possible to create one with HTML and update it using the shiny messaging system. This function appropriates the code from the shiny updateTextInput.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# textarea can be created in UI with HTML:
    HTML({"
        <label for='inText'>Old label</label>
        <textarea id='inText', class='textarea', placeholder= ''></textarea>"
    })

## Not run: 
# From ?updateTextInput
shinyServer(function(input, output, session) {

  observe({
    # We'll use the input$controller variable multiple times, so save it as x
    # for convenience.
    x <- input$controller

    # This will change the value of input$inText, based on x
    updateTextareaInput(session, "inText", value = paste("New text", x))

    # Can also set the label, this time for input$inText2
    updateTextareaInput(session, "inText2",
      label = paste("New label", x),
      value = paste("New text", x))
  })
})


## End(Not run)

jonkatz2/shinyAddOns documentation built on May 19, 2019, 7:30 p.m.