Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Help/Question: Validate one field at the time #72

Description

@elalienx

Hi, i being playing around with both Formisch and Valibot. I know the property form.validate set on blur runs the validations for all fields.

I wanted to know if there is a way to make it validate on field 1 field at the time so i could update the UI accordingly.

Case in point, I want the input field become blue 🔵 when the input is focused, 🟢 green when is validated, and 🔴 when it has an error.

This works perfectly for one input but on a two input formulary, I cannot manage to make second input wait until the user left the input field (onBlur()) to run the validation. The second field shows an error as soon as the user starts interacting with it, as the first input triggered the on blur event.

To explain it better, I managed to create a minimal example and wrote Playwright tests which explain the correct end state of all input combinations. Test 11 is failing due to the mentioned issue.

Any idea if is possible to do?

Link to minimal project: https://github.com/elalienx/formisch-on-blur

I know a forum is the correct place to ask this question, is there any Discord channel I could go to?

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions