VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.88k forks source link

Replace SmartForm #2279

Closed hjuarez20 closed 5 years ago

hjuarez20 commented 5 years ago

Hello and thanks for this amazing project. I want to add custom code in that component, but seeing the component this is not possible to replace it like others.

The custom code that I want to add is call a function to return the document before it submitted. I saw in the documentation that we can use the API methods as addToSubmitForm(function) and addToSuccessForm(function) but they return the document after the submitted.

Is there some workaround to allow me get data before the submit?

Thanks for the help.

SachaG commented 5 years ago

If you pass a function to the form as the submitCallback prop, it will run before the form is submitted:

https://github.com/VulcanJS/Vulcan/blob/devel/packages/vulcan-forms/lib/components/Form.jsx#L970-L973