updateTextMarkupInput: Change the value of a text markup input on the client

Description Usage Arguments See Also Examples

View source: R/update-textmarkup.R

Description

Change the value of a text markup input on the client.

Usage

1
2
updateTextMarkupInput(session, inputId, labels = NULL, values = NULL,
  placeholders = NULL)

Arguments

session

The session object passed to function given to shinyServer.

inputId

The id of the input object.

labels

The labels to set for the input object.

values

the values to set for the input object.

placeholders

The placeholders to set for the input object.

See Also

textMarkupInput

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Only run examples in interactive R sessions
if (interactive()) {
  library(shiny)
  library(shinyhighlightr)

  ui <- fluidPage(
    textMarkupInput(
      inputId = "highlight", labels = c("Expression", "Test Cases"),
      placeholder = c("Define Expression", "Define Test Cases"),
      values = list(
        "[1-2]{1}[0-9]{3}",
        c(
          "19th century", "1855",
          "between 1905 and 1910"
        )
      )
    ),

    div(
      class = "form-group shiny-input-container",
      actionButton("reset_expression", "Reset Expression"),
      actionButton("reset_test_cases", "Reset Test Cases")
    )
  )

  server <- function(input, output, session) {
    observeEvent(input$reset_expression, {
      updateTextMarkupInput(
        session, inputId = "highlight",
        labels = c("Expression Changed", NA),
        values = list("[1-2]{1}[7-8]{1}[0-9]{2}", NA),
        placeholders = c("Define Expression Changed", NA)
      )
    })

    observeEvent(input$reset_test_cases, {
      updateTextMarkupInput(
        session, inputId = "highlight",
        labels = c(NA, "Test Cases Changed"),
        values = list(NA, c("1750", "18th century")),
        placeholders = c(NA, "Define Test Cases Changed")
      )
    })
  }

  shinyApp(ui, server)
}

stefanieschneider/shinyhighlightr documentation built on Nov. 5, 2019, 9:21 a.m.