Dynamic input of fields

We have a form where users can dynamically add fields to the form. For example, if they have 3 pets, the we can collect the information of all 3 by allowing the user to click an ‘add pet button’. When they add the pet, it creates a new set of fields for that pet (ie pet_2_name, pet_2_type etc).

It looks like Netlify forms never sees anything beyond the initially rendered pet (pet_1_name, pet_1_type etc). Does Netlify forms support this type of dynamic form?

Nope, we don’t. Our forms, like most of our hosting, are static - they are processed at build time, and we will ONLY save fields that are defined in that static definition (in an html file, in your deploy).

The trick for dynamic fields is to define ALL of them in that html file - we will happily accept form submissions with any number of fields, including 0, or 10,000 - but we will only SAVE the pre-specified fields. So, if you think someone might make 100 pet names, please predefine pet_1_name through pet_100_name at build time, so we can recognize and capture all of them at browse time :slight_smile:

Hi, any update on this?

I have a quite complicated form with user added inputs, i’m struggling to send it correctly on netlify and with a json would everything easier.
I wonder if I can generate on the fly a json from the formData and attach it to the form like a file upload as a workaround?

hi there sintj,

nothing like what you are describing has changed to our forms since this thread was last active, i’m afraid. I can pass your feedback back to the product teams, and hopefully we will implement something that supports your use case in the future!