React-final-form: onSubmit should or should not touch all fields anymore?

Created on 13 Mar 2018  路  5Comments  路  Source: final-form/react-final-form

Is it normal that the fields are not getting touched after we submit? In redux-form all the field were set to "touched", this isn't the case in final-form. Just wondering if this is intended or not? I think I like it, but the examples are miss-leading then.

In the following code pen you can enter directly a password without touching the username. Then the submit validation is running which will catch the missing/wrong username and will return the error. But the error isn't shown because in all the examples the error is always in condition with meta.touched && ...

https://codesandbox.io/s/rmz7xmn44n

Any thoughts?

Edit: So the solution would be to change it from:

{(meta.error || meta.submitError) &&
                  meta.touched && <span>{meta.error || meta.submitError}</span>}

to

{(meta.error && meta.touched || meta.submitError)
                   && <span>{meta.error || meta.submitError}</span>}
bug

All 5 comments

@erikras Can you please have a look at this one, for me it is just a YES/NO question. Thanks for clarifying this 馃憤

That's very strange. Congrats! You've found a bug!

Published fix in [email protected].

Hey, I've just bumped into current behavior (after the fix), and was pretty confused.

The doc says

true if this field has ever gained and lost focus. false otherwise.

and it didn't mention failed submit at all.

What is the best way to get the behavior from the doc? Is there a different flag for this? I don't actually care if the form was submitted or not, I only want to know if the user actually touched it.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antoinerousseau picture antoinerousseau  路  3Comments

kiliw picture kiliw  路  4Comments

A11oW picture A11oW  路  3Comments

Noisycall picture Noisycall  路  4Comments

kavink picture kavink  路  5Comments