Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidify Form validation and submission pattern #66

Closed
1 task
levithomason opened this issue Oct 19, 2015 · 6 comments
Closed
1 task

Solidify Form validation and submission pattern #66

levithomason opened this issue Oct 19, 2015 · 6 comments

Comments

@levithomason
Copy link
Member

🪲 As a vendor, I want to know what registration fields are required, so that I don't skip important information


  • Create a working example form with validation, submission, and data handling (serializing).

Semantic UI form validation is built in and works with the form state and messages. We may or may not want to use this, but it should be understood before making final decisions.

image

@levithomason levithomason changed the title Support form validation Solidify Form validation and submission pattern Nov 20, 2015
@levithomason
Copy link
Member Author

Consider also AngularJS Forms. They provide a very robust solution around form validation and input state. Most appreciated is the fact that all form fields are automatically validated based on their HTML attributes (required, min, max, etc.) and these validations are consolidated into the formName.$valid value.

With this it is trivial to disable a submit button for a form if it is not valid (in React psuedo code):

<Button disabled={!this.refs.formName.isValid`}>Submit</Button>

Initial thoughts and proposal for Stardust forms inspired heavily by AngularJS with some tweaks:

Inputs

  • validate each form input based on it's html attributes
  • expose validation properties and methods that can be accessed via a ref
  • methods for setting validation state

Fields

  • aggregate validation from inputs inside the <Field />/<Fields />
  • expose validation properties and methods that can be accessed via a ref
  • methods for setting validation state

Forms

  • aggregate validation from inputs/fields inside the <Form />
  • expose validation properties and methods that can be accessed via a ref
  • methods for setting validation state

Classes
Flexible here as there are lots of opinions involved, but starting with something for us to go on.

  • apply validation classes on blur of a dirty input

@levithomason levithomason assigned ghost Nov 23, 2015
@levithomason
Copy link
Member Author

Related to TechnologyAdvice/unity-blog#197 TechnologyAdvice/unity-blog#201

@ghost
Copy link

ghost commented Nov 24, 2015

+100 for good documentation

@levithomason
Copy link
Member Author

:D

@ghost ghost mentioned this issue Nov 25, 2015
@ghost
Copy link

ghost commented Nov 25, 2015

Regarding approach here's a relevant opinion from Michael Bleigh:

Paragraphs, sections, articles, and lists are semantics that make sense in the context of a document, not an application.

However, his argument was not intended to sacrifice the *ilities of the Web, only to challenge the status quo. And I personally have had good luck leaning into Web semantics as a way to help ensure better accessibility while also providing a familiar pattern to hold onto while coding web forms in single-page apps.

Given Semantic UI doesn't actually use good form semantics I'm going to start spiking towards a solution with markup semantics similar to that of Angular's, referencing the SUI docs and form.js for feature parity with a behavior rewrite, using Material UI where possible for implementation patterns.

@levithomason
Copy link
Member Author

These basics were added in #130, see #131 for continued iteration.

@levithomason levithomason unassigned ghost Oct 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant