Skip to content

Instantly share code, notes, and snippets.

@levibuzolic
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levibuzolic/5d8aac19753e94e1d0e8 to your computer and use it in GitHub Desktop.
Save levibuzolic/5d8aac19753e94e1d0e8 to your computer and use it in GitHub Desktop.
Thoughts on advanced client side validation

Validation Creation

Instant (onChange)

Validations that will run on every keystroke, most of these validations should ideally be prevented by input restrictions or sanitization of data.

  • Maximum length
  • Invalid characters

Complete (onBlur)

Most client-side validations should be handled in this cycle.

  • The above validations, in addition to:
  • Email formatting
  • Field regex
  • Minimum length / number

Submit (onSubmit)

Advanced validations.

  • The above validations, in addition to:
  • Async (server-side)
  • Multi field dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment