form icon indicating copy to clipboard operation
form copied to clipboard

No way to access errors for a group defined with `withFieldGroup`

Open pifantastic opened this issue 4 months ago • 4 comments

Describe the bug

When defining a group using withFieldGroup, it would be helpful to get a list of all of the errors for the group.

As an example, I have an address group. I'd like to render a list of errors at the group level (as opposed to the individual field level:

Image

However, the group store only contains values. You can get the form-level errorMap and sort of work backwards, but that's somewhat difficult. It would be really nice if the group store had an errorMap or something similar.

Your minimal, reproducible example

https://bolt.new/~/sb1-ehaxlmcw

Steps to reproduce

Here is an example of the kind of form I mean.

Expected behavior

It should be possible to get the errors for a group.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

macOS/Chrome

TanStack Form adapter

None

TanStack Form version

1.15.1

TypeScript version

No response

Additional context

No response

pifantastic avatar Jul 31 '25 23:07 pifantastic

It wasn't initially part of the PR since field groups are supposed to link fields and forms together, not store (too much) state itself.

However, I see the use cases for including it!

LeCarbonator avatar Aug 01 '25 06:08 LeCarbonator

Just to add to this my use case is for a field group looking like this

Image

and I want my errors to show like the below instead of under the field and wrapping

Image

dan-gamble avatar Aug 20 '25 10:08 dan-gamble

An additional request here, accessing form meta in the field group. My specific use case is showing additional address fields like line 2 etc. only if line 1 is touched.

seththoburn-cc avatar Sep 09 '25 19:09 seththoburn-cc

I second this requests, got into simmilar case and there is no way to get the errors back when they should group.getFieldMeta is getting fired but the errors are not passed into it until next rerender

Kacper-kruczek96 avatar Nov 28 '25 10:11 Kacper-kruczek96