Skip to content

Instantly share code, notes, and snippets.

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 jasonneylon/313cb475b3acb6856c9c to your computer and use it in GitHub Desktop.
Save jasonneylon/313cb475b3acb6856c9c to your computer and use it in GitHub Desktop.
Example of submitting form and validating javascript
// When submitting the form we use standard jquery validation
$form.submit(function handleSubmit(ev) {
// call the React address component instance and ask it to validate itself and return any errors
const errors = addressInstance.validate();
// if there are errors cancel the form submit
if(errors.length > 0) {
ev.preventDefault();
}
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment