Skip to content
Source
Sign inSign up
TanStack/form

[Docs] Add more info to the guide page about validation #477

Send to my agent
Closedjuliendelort(GitHub profile, opens in a new tab) opened this issue 6 comments

Some topics that the page should cover:

  • [Already partially covered] How do I validate fields and when (on change, on blur, on submit, on mount)? Especially addressing confusions like this.
  • More details about showing validation errors: should I use field.state.meta.touchedErrors or field.state.meta.errors? Should I loop over them?
  • Handling validation at the fields level (using each field onChange) vs at the form level (using the callbacks in useForm). Can I do a mix of both? Should I?
  • How do I handle validation rules that include multiple fields (for example a “password” and a “repeat password” field that need to be identical, or a “start date” that needs to be before an “end date”).
  • Show the possible ways to prevent submitting invalid forms.
  1. This makes sense to me, especially with Form.Subscribe not being the most straightforward API design

  2. crutchcorn(GitHub profile, opens in a new tab) added labelstype: enhancement

  3. crutchcorn(GitHub profile, opens in a new tab) added labelsgood first issue

  4. crutchcorn(GitHub profile, opens in a new tab) added labelstype: docs

  5. crutchcorn(GitHub profile, opens in a new tab) assignedjuliendelort

  6. @crutchcorn I'm trying to push my branch in order to open a PR but looks like I don't have permission:

    remote: Permission to TanStack/form.git denied to juliendelort.

    fatal: unable to access 'https://github.com/TanStack/form.git/': The requested URL returned error: 403

  7. Hey @juliendelort - you'll need to fork the repo:

    https://docs.github.com/en/get-started/quickstart/fork-a-repo

    Then make a pull request from your fork to this repo 😊

    Let me know if there's anything I can do to help answer! Happy to walk through step-by-step

  8. Haha I'm such a noob 😅 Thanks @crutchcorn I should be good now!

  9. Closing, as @juliendelort has addressed most of these concerns in the now-merge #484.

    This doesn't mean our validation docs can be added onto and improved, however! If anyone sees room to improve, feel free to make a PR or follow-up issue!

Sign in to join this conversation.