Last active
November 5, 2018 17:19
-
-
Save redgeoff/4af55f199cc3cae02e4bb1c01bef1f94 to your computer and use it in GitHub Desktop.
Autogenerating Forms Old - Conditional Submit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleSubmit = () => { | |
const { form } = this.state; | |
// TODO: Contact some API with the data | |
console.log("submitting", form.getValues()); | |
// Simulate response from API saying that email address is already in use and report this error | |
// to the user | |
if (form.get("fields.email.value") === "[email protected]") { | |
form.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