Formik: Form submission of invalid forms

Created on 7 Aug 2018  路  6Comments  路  Source: formium/formik

Current Behavior

Submission is only possible if the form is valid.

Desired Behavior

It might sound obscure, but sometimes you want to submit invalid forms as well. E.g. Drafts of something.

Suggested Solution

Add property to enable submission of invalid forms.

Enhancement stale

Most helpful comment

To still give the user feedback if everything is fine. (Th form stays open or touched fields)

Yes, true, thats how I do it currently. Just a suggestion, maybe I am not the only one :)

All 6 comments

816

Then why you need a validation at the first place?

You can completely omit validation functionality provided by Formik and handle necessary validations inside your own handleSubmit function.

To still give the user feedback if everything is fine. (Th form stays open or touched fields)

Yes, true, thats how I do it currently. Just a suggestion, maybe I am not the only one :)

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.

I will close it for now, may re-open in a future if needed.

I've actually come up to this situation. It's not the exact same scenario, but the same feature would be needed to properly support it:

  • I have a form that is a list of new users to be added. This can be any number of users.
  • Each user has first name, last name, email, country. If any of these are blank/otherwise invalid, that user is invalid

Then the customer decided they didn't want the operation to be atomic, instead all valid users should be submitted, and removed from the FieldArray, all invalid should stay to be fixed. I don't particularly like this idea (and said as much), but it is what I'm being paid to do. Right now my plan is to re-implement visual validation as part of onBlur/onChange, form level validation in onSubmit. But a simple toggle that would call submit even if not everything was valid would be very useful in not having to do any of that. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaredpalmer picture jaredpalmer  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments

green-pickle picture green-pickle  路  3Comments

najisawas picture najisawas  路  3Comments

sibelius picture sibelius  路  3Comments