Add new fields on click of a button


Hello.

I was wondering if it is at all possible to add new fields to a form by clicking a + button?
I was thinking of writing something in javascript to help… But if there is something already, please do let me know!

Thanks!


5 replies

Userlevel 7
Badge +1

Hey Eugene!

@Hristian’s a Javascript wizard, so he’d know if it’s possible to achieve this – but almost more importantly, he knows if it’s worth the time it would take to implement it. If he’s got a moment, hopefully he can shed some light on this!

Cheers!

Userlevel 7
Badge +3

Hi Eugene,

It would be easier to hide the extra fields and only reveal them when you click the + button.

Adding fields to a native form after the fact would be just about impossible.

Best,
Hristian

P.S. Keep in mind you have to account for the extra space that you would need around your form to show/hide these extra fields.

Hi Hristian,

Yes that’s what i’ve done.
Do you know of anyway to make the size of a container (box in unbounce) fluid so that if more fields are added (using jquery show/hide) then the container grows?

Cheers

Userlevel 7
Badge +3

Hi Eugene,

Making the container expand/contract is actually the easy part.
The problem is with the content below/above said container since you have to move it accordingly.

I’ve done expandable content sections before and in 99.9% of the cases, it takes too much development time to be worth it.

Best,
Hristian

My form is in a lightbox so there is no content below of above it.
I am wondering if you could send me an example of an expandable container?

Cheers

Reply