react-native-gifted-form icon indicating copy to clipboard operation
react-native-gifted-form copied to clipboard

Way to submit a form programatically

Open TroutZen opened this issue 8 years ago • 1 comments

Is there a way to submit the form programmatically? Use case: currently using react-native-router-flux and want to bind a form submit to their Scene onRight callback.

TroutZen avatar Sep 27 '16 21:09 TroutZen

I am also using react-native-router-flux with success.

If you don't care about displaying errors you can do the following...

var validationResults = GiftedFormManager.validate('formname');
if(validationResults.isValid) {
    var values = GiftedFormManager.getValues('formname');

    // do your processing here

    // remove the scene
    Actions.pop();
}

I have submitted a pull request that allows you to programmatically display the errors too, the problem is it's 22 days old and and the developer doesn't seem to be active anymore.

Hope this helps.

sambwest avatar Sep 27 '16 22:09 sambwest