Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate form after adding a new type #557

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Conversation

wbazant
Copy link
Collaborator

@wbazant wbazant commented Nov 1, 2024

Closes #553.

Formik can re-validate a field after setFieldValue, but doesn't do that for the whole form, and we have just a global validator (validateLocationStep). Trigger it after adding a new type so the form realises the types field is no longer empty.

@ezwelty
Copy link
Collaborator

ezwelty commented Nov 6, 2024

@wbazant Thanks! This fixes the issue of Types still being red after adding a new type, but Types is still red when opening a blank form, which feels unexpected ("how did I already do something wrong, I only just opened the form!"). I'd expect a behavior more like the problem report, where the required field Problem type only goes red once another input is touched. Is that possible with Types?

@wbazant
Copy link
Collaborator Author

wbazant commented Nov 7, 2024

Thanks! I agree the type shouldn't be red on start, you've pointed it out in the original comment but I missed it. Bizarrely, it was configured to do it, and we have a bunch of them (some of which don't do anything). I'll review the other ones too, see #571

@wbazant wbazant merged commit c360c8f into falling-fruit:main Nov 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding new type should make the form dirty
2 participants