The issue: I don't want to use the submit widget to submit my forms, I want to use a button the navigation bar. (it could be any button). Putting the error generation as part of the SubmitWidget assumes too much about how I want to submit the form.
The module currently generates errors as part of the submit widget. I have extracted that functionality out and added it as a utility method as: GiftedFormManager.getValidationErrors.
This means in my navigation by I can use it as follows:
action: () => {
// get the validation results
var validationResults = GiftedFormManager.validate(this._form.props.formName);
// is the form valid?
if(validationResults.isValid) {
// get the values
var values = GiftedFormManager.getValues(this._form.props.formName);
// dispatch to add booking
this.props.store.job.addBooking(values);
// remove the scene
Ugo.Actions.pop();
}
else {
// get the errors
var errors = GiftedFormManager.getValidationErrors(validationResults);
// update the form's state with the errors
this._form.setState({errors});
}
}
The change is transparent to the current SubmitWidget.
Hi,
The issue: I don't want to use the submit widget to submit my forms, I want to use a button the navigation bar. (it could be any button). Putting the error generation as part of the SubmitWidget assumes too much about how I want to submit the form.
The module currently generates errors as part of the submit widget. I have extracted that functionality out and added it as a utility method as: GiftedFormManager.getValidationErrors.
This means in my navigation by I can use it as follows:
The change is transparent to the current SubmitWidget.