Skip to content

Instantly share code, notes, and snippets.

@redgeoff
Created November 5, 2018 17:40
Show Gist options
  • Save redgeoff/e4a27e3c3ae909b3671728f603dcd842 to your computer and use it in GitHub Desktop.
Save redgeoff/e4a27e3c3ae909b3671728f603dcd842 to your computer and use it in GitHub Desktop.
Autogenerating Forms - Conditional Submit
onSubmit={({ component }) => {
// TODO: Contact some API with the data
console.log("submitting", component.getValues());
// Simulate response from API saying that email address is already in use and report this
// error to the user
if (component.get("fields.email.value") === "[email protected]") {
component.set({ "fields.email.err": "already in use" });
} else {
// Everything was successful so redirect, show confirmation, etc...
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment