Skip to content

Form Validation #386

@ashbaldry

Description

@ashbaldry

The {shinyvalidate} package doesn't seem to work with {shiny.semantic}. However Fomantic UI has out of the box form validation. It would be good to include this in the package.

I've been working on a POC of this, by being able to add the validation at the end of a form. It also includes a submission button, that will only trigger reactive events if the form passes validation.

Example:

  library(shiny)
  library(shiny.semantic)

  ui <- semanticPage(
    form(
      id = "form",
      field(
        tags$label("Name"),
        text_input("name")
      ),
      field(
        tags$label("E-Mail"),
        text_input("email")
      ),
      form_validation(
        id = "form",
        field_valitaion("name", field_rule("empty"))
        field_valitaion("email", field_rule("empty"), field_rule("email"))
      )
    )
  )

  server <- function(input, output) {
  }

  shinyApp(ui, server)
127.0.0.1_4395.and.3.more.pages.-.Personal.-.Microsoft.Edge.2021-10-18.18-53-00.mp4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions