final-form / final-form/react-final-form

Prevent field validation on form mount

Open
#602 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

**bug report**/**feature request**

### What is the current behavior?

field validation runs on mount of form

```javascript
validateRequiredEmail(value, 'investorEmail', 3)}
/>
```

the field behaves correctly, when error is not collected through
`error={this.props.error || this.props.meta?.error}` but only `this.props.error`, but I would like not to have these hacks in my code. Is there elegant solution?

### What is the expected behavior?

prevent validation from running on the first render

can be acomplished by

validate={(value, values, meta) => meta.touched && validateRequiredEmail(value, 'investorEmail', 3)} , but then doesn't validate on form submit

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.