TanStackT
TanStack4mo ago
13 replies
broad-emerald

Dynamic form fields from database based on field value

Hi, I'm struggling to find a solution were I have a form with a field that determines what other fields to display based on the database tables.

For example,
Field: Asset Type = enum
On field selection, get attribute field definitions from db and display attribute fields
[{name: foo, type: number, default_value: 1}]

Since the schema and default values for the form are defined up front, is it possible to do this in a single form, or do I need to nest the attributes as a separate form? If so, how could I combine the forms state on submit?
Was this page helpful?