Description Usage Arguments Details Value References See Also Examples
A form validation behaviour checks data against a set of criteria before passing it along to the server.
1 2 3 4 5 6 7 8 | form_validation(
id,
...,
submit_label = "Submit",
submit_class = "",
include_button = TRUE,
inline = FALSE
)
|
id |
ID of the parent form |
... |
A series of |
submit_label |
Label to give the submission button at the end of the form (included in returned UI with input
value |
submit_class |
Additional classes to give the submission button |
include_button |
Logical, should the submit button be included? Defaults to |
inline |
Logical, do you want the field validation errors as in-line labels ( |
In order for the validation to work, the form_validation
must be a direct child of the form
.
The "Submit" button has an input value of {id}_submit
and will only trigger
server-side events if all the fields pass validation.
NB If you do not include either form validation input as part of the server-side code then the inputs will pass through to the server as if there were no validation.
A shiny.tag.list
containing the inline JS to perform the form validation in the shiny UI.
If include_button = TRUE
then a button will also be included to appear in the UI.
https://fomantic-ui.com/behaviors/form.html
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 | if (interactive()) {
library(shiny)
library(shiny.semantic)
library(fomantic.plus)
ui <- semanticPage(
tags$head(
extendShinySemantic()
),
form(
id = "form",
field(
tags$label("Name"),
text_input("name")
),
field(
tags$label("E-Mail"),
text_input("email")
),
form_validation(
id = "form",
field_validation("name", field_rule("empty")),
field_validation("email", field_rule("empty"), field_rule("email"))
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.