Dynamic Field insertion?

toad 08 Sep, 2015
I have a student registration form that has a set of standard, default fields. But we need the ability to add an additional set of fields for additional students to register only accessible to one single button named "Add Additional Students". This needs to be able to insert an unlimited amount of additional students plus post these results in the Admin's email.

Can Chronoforms do this and how can I find tutorials to do this?
GreyHead 08 Sep, 2015
Hi toad,

The Multiplier might do what you need, Please see this FAQ

Bob
toad 08 Sep, 2015
Is there a working example? I'm looking for something like this: http://www.sanwebe.com/2013/03/addremove-input-fields-dynamically-with-jquery. Would what you recommend do it?
toad 08 Sep, 2015

Hi toad,

The Multiplier might do what you need, Please see this FAQ

Bob



Okay, so I'm a little stuck on this part:
Setting element names and ids

So I would go into each element's settings and change the Field ID and Field Name to student_##, gender_##, allergies_##, etc. (I set 'Replacer' to ##), correct? Looking at the frontend and accessing the multiplier, it looks like it is populating like it should.

My next question is, I tested the form (never received the email, which is a separate issue itself), but I wanted to verify with you with the screenshots if all looks as it should when being sent to the administrator. I don't see in the 'Body' code email any of the additions selected from the form. For example, I don't see 'student_1' nor 'student_2' information in the email.

The Email settings show this:

<table>
<tr><td></td><td>{name}</td></tr>
<tr><td></td><td>{age}</td></tr>
<tr><td></td><td>{gender}</td></tr>
<tr><td></td><td>{student_##}</td></tr>
<tr><td></td><td>{gender_##}</td></tr>
<tr><td>Custom Code</td><td>{custom}</td></tr>
<tr><td>Enter Code</td><td>{captcha}</td></tr>
<tr><td>{label}</td><td>{captcha}</td></tr>
</table>

[attachment=0]screen1.PNG[/attachment]
[attachment=1]screen2.PNG[/attachment]

Recommendation?
toad 08 Sep, 2015
Maybe you can take a look and figure out why the arrays are not populating in the email?

This is private content



Thank you.
GreyHead 09 Sep, 2015
Hi toad,

You have chose not to user array names for the multiplier field so you need to use custom PHP to build that part of the email template as the number of entries will change. Better to go back to the FAQ and use the array version of the names.

Bob

PS I also recommend that you do not use the On Success box of the Check action, just put the email after the Check action.
toad 09 Sep, 2015
Well now I'm not getting any multiplier data. I'm not sure where I'm going wrong.

This is private content

toad 09 Sep, 2015
So I followed the instructions, again, and see the array. But nothing is posting in the email template.

[attachment=0]no-email-post.gif[/attachment]
toad 09 Sep, 2015

Hi toad,

You have chose not to user array names for the multiplier field so you need to use custom PHP to build that part of the email template as the number of entries will change. Better to go back to the FAQ and use the array version of the names.



I need to use a php loop because the user needs the flexibility to add as many more students as they like.
toad 09 Sep, 2015
I've added the PHP loop found here and adapted it to the example I've been working with, to no avail. I'm still not seeing anything posting in the email.

This is private content

GreyHead 10 Sep, 2015
Hi toad,

You can't copy PHP from another form and expect it to work on yours without editing it - there is no 'counter' input in your form data. I personally wouldn't use that anyhow, I posted a different version at the end of that thread that may work better as a basis for your code.

Bob
This topic is locked and no more replies can be posted.