I have the need for a "Soft Stop" in my form. That means when the person tries to submit the form the first time, they get an error on fields that we recommend they fill out, but are not necessary. They second time they press submit regardless of if they have filled out the fields or not, they are allowed to continue. Is there a way to use yup and formik to do this? Or do we need to manage the state outside of the frameworks?
@sepehr500 You can add some react state like counter and perform checking if submit pressed second time inhandleSubmit
This use case happens often, so I wanted to add a softRequired type to yup to make this reusable. Do you know if yup types can hold state?
I have a form like this too in one of our apps. I just used status. It was kind of gross. Would love to see what you come up with.
Do you think it should be a feature of formik? Or should the solution exist outside of Formik?
The way I ended up solving this problem was wrapping Formik to intercept the component to be rendered before it gets passed in as props to Formik, then we could make onSubmit do whatever we want. We might get a lot of benefit if we made a beforeValidate hook or something that would run before validation and determine weather validation needs to be run or not.
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.
ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.
@sepehr500 could you share an example of your approach? would be really useful to see.