Dynamically Added Form Fields

Hello !

I recently came across a simple form which allowed users to add a specified number of input fields (as needed). To my knowledge there’s no way to natively do this with webflow forms , could anyone guide me on how I can build / code one?

My idea is that it would be some onClick event on an icon or something to create the input fields but I don’t know specifically how to go about it. A Javascript / JQuery library solution is welcome as well !

Here’s a screenshot of what I mean

Hi @boafo

Did you mange to complete this in Webflow at all?

I’m looking to do something similar at the moment.

Many thanks

Hey @Darius_Safavi

Unfortunately I haven’t been able to implement it yet but I will let you know if that changes!

If you figure out a solution before I do, please send it my way as well - I’d really appreciate that

Best

@boafo @Darius_Safavi did you already find a solution for this?

This is one of those UX’s that’s a bit different for each client, so it’s tricky to build a one-size-fits-all solution. However the basic approach is to use custom code to duplicate your form sub-section, and then append a suffix to the name -2, -3, etc.

It gets a bit more complex with e.g. multi-item additions, item removals, more than 1 initial item, item re-ordering, and automatic pre-submit cleanup of empty fields. But other than that if they’re simple input fields this works OK.

I personally prefer to have the script also append -1 to the initial item names for consistency on the form submit data, and I double-wrap the DIVs for convenience of cloning and counting. I also tend to scrape any ID’s ( Webflow likes to add these automatically to form fields ), because they may confuse scripts.

If you need help and have a specific form design you can show me, DM me with the details and I can give you an estimate.

1 Like