Description Usage Arguments Details Value See Also Examples
This is a series of textInputs fields with a functionality for validating the provided text inputs.
1 |
input |
argument used by shiny session |
output |
argument used by shiny session |
session |
argument used by shiny session |
n |
int number of textInput fields. n must be length(labels) from FileUploadUI. |
checkFun |
chr or NULL (NULL) if not NULL name of a function which can be used as a quality check for textInputs |
addArgs |
list or NULL (NULL) if not NULL list of additional arguments which will be passed to checkFun |
With argument checkFun a function name can be defined which will be used as quality control for the text inputs. This function must take a chr arr as first argument. These are the user provided text inputs. The function must either return NULL or a chr value. NULL means the input is valid. Thereby the module returns this chr arr. If the user input should not be valid, the function must return a character value. This chr value will be rendered as a error message for the user, and the modul returns NULL.
Additional argumets can be handed over to checkFun via the list addArgs.
chr arr of user provided text input fields or NULL
Other TextInput module functions: TextInputUI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(shinyTools)
# some function as example
check <- function(text, add){ if(any(grepl(add$pat, text))) return(paste("Don't use letter", add$pat, "in any entry."))}
# little app with module
ui <- fluidPage(sidebarLayout(
sidebarPanel(h2("TextInputUI"),
TextInputUI("id1", c("positive Ctrls", "non-targeting Ctrls"), c("positive", "non-targeting"),
help = "use HGNC symbols", horiz = FALSE)
),
mainPanel(h2("Output of TextInput"), verbatimTextOutput("display"))
))
server <-function(input, output, session) {
display <- callModule(TextInput, "id1", n = 2, checkFun = "check", addArgs = list(pat = "X"))
output$display <- renderPrint(display())
}
shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.