Forums

How do I set up the ability to click to add a field

emills01 19 Sep, 2014
I'm setting up Chronoforms for an insurance agent who asks a series of questions in order to be able to provide an insurance quote.

He needs to know the number of people in a family but we don't want to just include a lot of fields for people who might be on their own.

Right now I have a multifield set up for the applicant's gender and birthdate (which is just a text field). How would I include something that would allow them to click a link to insert a field for a spouse, and something similar to add children, one at a time?

And I'm assuming that once this is done only the fields that have been manually added by the applicant are included in the email?
GreyHead 20 Sep, 2014
Hi emills01.

This is possible with CFv5 by using two built-in features. One allows you to hide a section of a form and have it displayed depending on the setting of some other form element; the other one allows you to set a Multiple option on a container with a group of elements and display a new copy when an icon is clicked.

These will probably do what you need - alternatively, you can use JavaScript to get similar but more customised results.

Bob
emills01 22 Sep, 2014
The second feature sounds like what I am looking for - what is it called and how can I find it?
GreyHead 23 Sep, 2014
Hi emills01,

I'm travelling this week . . . from memory, add a container, set it to Type multiple - check the Multiple tab, the default settings are probably OK.

Add inputs to the container and give them names containing 0 e.g. name[0] or name_0 and ID=name_0

Test, you should see add and move buttons and each added set of inputs should have the 0 in the name and id replaced with 1, 2, etc.

Bob
emills01 25 Sep, 2014
When I click on Edit for the container, "Multiple" isn't an option. I have the following available:

None
Page
DIV
Field Set
Panel
Tabs Area
Tabs Area (Menu)
Tab
Sliders area
Slider
Columns container
Column
Custom
GreyHead 26 Sep, 2014
Hi emills04,

Please upgrade to the latest version of CFv5 - you should see Multiplier at the end of the Types list.

Bob
emills01 26 Sep, 2014
That seems to be doing the trick...couple questions though:

One of the fields is a drop down (to specify the gender of the child). On the first instance it is a regular dropdown where you click the arrow to show the options, but on each added instance it is not a dropdown per se - it is a box with the two options in which you select one. Functionally it is the same, but my client is not going to like that it looks different.

Also, I'm getting the green plus icon to add an instance, but is there a way to specify what this does? I'd lik to add some text next to it that says "click here to add information for another dependent" or something along those lines so it is perfectly clear.

I'd also like to be able to add something for the red X removal icon.

Finally, in the generated email it doesn't contain the informaitio submitted in the form. I created a test with 4 different "children" and all that came out was a single instance which looked like this:

Child
Child's Gender

Without the submitted info for either field...
GreyHead 27 Sep, 2014
Hi emills01,

It sounds as though your drop-down may be set with multiple on or with size greater than 1?

I haven't seen any obvious way of adding text to the buttons, it might be possible to add a <span> using JavaScript.

The email problem may be because the names don't match - you haven't given enough info to diagnose this. Do you have array names for the multiple elements?

Bob
emills01 01 Oct, 2014
Multiple on the dropdown is set to OFF.

Array names for the multiple elements - I'm not sure. What might that look like or what should I be seeing if I do?

I have two elements inside the container, a dropdown and a text.

For the dropdown I have... field name: name[0] and field ID: ID=name_0

For the text I have... field name: name[0] and field ID: ID=name_0
This topic is locked and no more replies can be posted.