| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/update-input.R |
| 3 |
\name{updateTextAreaInput} |
| 4 |
\alias{updateTextAreaInput} |
| 5 |
\title{Change the value of a textarea input on the client} |
| 6 |
\usage{ |
| 7 |
updateTextAreaInput( |
| 8 |
session = getDefaultReactiveDomain(), |
| 9 |
inputId, |
| 10 |
label = NULL, |
| 11 |
value = NULL, |
| 12 |
placeholder = NULL |
| 13 |
) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{session}{The \code{session} object passed to function given to |
| 17 |
\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} |
| 18 |
|
| 19 |
\item{inputId}{The id of the input object.} |
| 20 |
|
| 21 |
\item{label}{The label to set for the input object.} |
| 22 |
|
| 23 |
\item{value}{Initial value.} |
| 24 |
|
| 25 |
\item{placeholder}{A character string giving the user a hint as to what can |
| 26 |
be entered into the control. Internet Explorer 8 and 9 do not support this |
| 27 |
option.} |
| 28 |
} |
| 29 |
\description{ |
| 30 |
Change the value of a textarea input on the client |
| 31 |
} |
| 32 |
\details{ |
| 33 |
The input updater functions send a message to the client, telling it to |
| 34 |
change the settings of an input object. The messages are collected and sent |
| 35 |
after all the observers (including outputs) have finished running. |
| 36 |
|
| 37 |
The syntax of these functions is similar to the functions that created the |
| 38 |
inputs in the first place. For example, \code{\link{numericInput}()} and |
| 39 |
\code{updateNumericInput()} take a similar set of arguments. |
| 40 |
|
| 41 |
Any arguments with NULL values will be ignored; they will not result in any |
| 42 |
changes to the input object on the client. |
| 43 |
|
| 44 |
For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and |
| 45 |
\code{\link{selectInput}()}, the set of choices can be cleared by using |
| 46 |
\code{choices=character(0)}. Similarly, for these inputs, the selected item |
| 47 |
can be cleared by using \code{selected=character(0)}. |
| 48 |
} |
| 49 |
\examples{ |
| 50 |
## Only run examples in interactive R sessions |
| 51 |
if (interactive()) { |
| 52 |
|
| 53 |
ui <- fluidPage( |
| 54 |
sliderInput("controller", "Controller", 0, 20, 10), |
| 55 |
textAreaInput("inText", "Input textarea"), |
| 56 |
textAreaInput("inText2", "Input textarea 2") |
| 57 |
) |
| 58 |
|
| 59 |
server <- function(input, output, session) { |
| 60 |
observe({ |
| 61 |
# We'll use the input$controller variable multiple times, so save it as x |
| 62 |
# for convenience. |
| 63 |
x <- input$controller |
| 64 |
|
| 65 |
# This will change the value of input$inText, based on x |
| 66 |
updateTextAreaInput(session, "inText", value = paste("New text", x)) |
| 67 |
|
| 68 |
# Can also set the label, this time for input$inText2 |
| 69 |
updateTextAreaInput(session, "inText2", |
| 70 |
label = paste("New label", x), |
| 71 |
value = paste("New text", x)) |
| 72 |
}) |
| 73 |
} |
| 74 |
|
| 75 |
shinyApp(ui, server) |
| 76 |
} |
| 77 |
} |
| 78 |
\seealso{ |
| 79 |
\code{\link[=textAreaInput]{textAreaInput()}} |
| 80 |
} |