question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Soft Stop" Formik validation

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sepehr500commented, Mar 3, 2018

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.

1reaction
juanpicadocommented, Aug 20, 2019

@sepehr500 could you share an example of your approach? would be really useful to see.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validation - Formik
Formik is designed to manage forms with complex validation with ease. Formik supports synchronous and asynchronous form-level and field-level validation.
Read more >
How to clear status before validation on Formik submit?
Option 1. You can add validate call in every form input so when ever user change input status message will be cleared.
Read more >
Build React forms and validation with Formik like a boss
Store input in the container component's state. Validate them after the user hits submit and before you actually submit the data to a...
Read more >
React Form Validation With Formik + GraphQL + Yup
Learn how to validate user registration forms with a modern technology stack, including React, GraphQL, Formik and Yup.
Read more >
Validating Forms with Formik + Fonk - Basefactor
The main goal of Formik is to colocate get/set values from form state, handle validation and error messages, handle form submission all in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found