Support Forums

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: