| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/update-input.R |
| 3 |
\name{updateCheckboxInput} |
| 4 |
\alias{updateCheckboxInput} |
| 5 |
\title{Change the value of a checkbox input on the client} |
| 6 |
\usage{ |
| 7 |
updateCheckboxInput( |
| 8 |
session = getDefaultReactiveDomain(), |
| 9 |
inputId, |
| 10 |
label = NULL, |
| 11 |
value = NULL |
| 12 |
) |
| 13 |
} |
| 14 |
\arguments{ |
| 15 |
\item{session}{The \code{session} object passed to function given to |
| 16 |
\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} |
| 17 |
|
| 18 |
\item{inputId}{The id of the input object.} |
| 19 |
|
| 20 |
\item{label}{The label to set for the input object.} |
| 21 |
|
| 22 |
\item{value}{Initial value (\code{TRUE} or \code{FALSE}).} |
| 23 |
} |
| 24 |
\description{ |
| 25 |
Change the value of a checkbox input on the client |
| 26 |
} |
| 27 |
\details{ |
| 28 |
The input updater functions send a message to the client, telling it to |
| 29 |
change the settings of an input object. The messages are collected and sent |
| 30 |
after all the observers (including outputs) have finished running. |
| 31 |
|
| 32 |
The syntax of these functions is similar to the functions that created the |
| 33 |
inputs in the first place. For example, \code{\link{numericInput}()} and |
| 34 |
\code{updateNumericInput()} take a similar set of arguments. |
| 35 |
|
| 36 |
Any arguments with NULL values will be ignored; they will not result in any |
| 37 |
changes to the input object on the client. |
| 38 |
|
| 39 |
For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and |
| 40 |
\code{\link{selectInput}()}, the set of choices can be cleared by using |
| 41 |
\code{choices=character(0)}. Similarly, for these inputs, the selected item |
| 42 |
can be cleared by using \code{selected=character(0)}. |
| 43 |
} |
| 44 |
\examples{ |
| 45 |
## Only run examples in interactive R sessions |
| 46 |
if (interactive()) { |
| 47 |
|
| 48 |
ui <- fluidPage( |
| 49 |
sliderInput("controller", "Controller", 0, 1, 0, step = 1), |
| 50 |
checkboxInput("inCheckbox", "Input checkbox") |
| 51 |
) |
| 52 |
|
| 53 |
server <- function(input, output, session) { |
| 54 |
observe({ |
| 55 |
# TRUE if input$controller is odd, FALSE if even. |
| 56 |
x_even <- input$controller \%\% 2 == 1 |
| 57 |
|
| 58 |
updateCheckboxInput(session, "inCheckbox", value = x_even) |
| 59 |
}) |
| 60 |
} |
| 61 |
|
| 62 |
shinyApp(ui, server) |
| 63 |
} |
| 64 |
} |
| 65 |
\seealso{ |
| 66 |
\code{\link[=checkboxInput]{checkboxInput()}} |
| 67 |
} |