Skip to content
Source
Sign inSign up
TanStack/form

[Docs] Guide about dynamic forms & nested fields #481

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

A common use case with forms is showing or hiding fields based on other field’s values. For example, a “select a reason” form that has an “other” checkbox that shows an extra textarea (”please specify”) when checked.

Nested fields should be covered as well: For example, if a specific field is of type string[] and I need to have an input for each entry (and a “add item” button that adds a new input), how should I handle it? Do I need a data transformation layer?

More about nested fields: https://informel.site/nested_fields

  1. Love this, yeah. We support this today using the index field, but we also could use some more tests to validate this functionality as well.

    For anyone working on these docs, be aware that this functionality may change before v1.0. Not a blocker for documenting, just that it may need updating in the future

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

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

  4. This might not be the right thread but I'd be interested knowing how to handle validation for nested fields e.g. in the case that "other" is selected here, that the textarea ("specify reason") is required, but in the case that "other" is not selected, that the validation does not affect it (as it is presumably empty).

  5. I'm going to mark this as completed, see the related docs 📖

    Array fields Reactivity Linked Fields Listeners

Sign in to join this conversation.