Repeater forms

fribse 18 Apr, 2019
Answer
2 Likes
Having struggled through the repeater-area form, I wanted to post a few images on how it's done. I see a lot of explanation, but not a single image explaining it.
Remember to distinguish between square and curly brackets.

First of, insert a repeater area in you designer where you need it.


Repeater forms image 1

Some important info is here, first of the area reference, this is here area_repeater11, it will probably be another number for you, but keep the ID in mind.
Secondly, the Data provider tells CF where to store the entered data.
Lastly, if you want to be able to add more repeats, you should notice the 'Multiply button selector'

Then place the fields inside the repeater area

Repeater forms image 2

As this example is multilingual, the label contains the notation needed for that, but the important part is the Name.
The Name contains a variable called order, and inside that is a counter, shown as {var:area_repeater11.key}, as you can see the area_repeater11 refers to the name of the repeater area from above. Last is just the name of the field in this repeate: [antal]
Also note that I do NOT select 'include value in email' OR 'save to database'. These settings will only work for non-repeated fields.

Last part is to add the 'Add new' button, that is placed in the Footer of the Repeater area.

Repeater forms image 3


Here, the Class refers to the class set up in the repeater area.

That is all for the design part, you can of course have multiple fields inside the repeater area.

Then in the Actions after the Submit you need to enter a loop.

Repeater forms image 4

The Name here is the counter for the loop, and then all the repeated fields are added.
In this case, they are added with HTML tags for a table, and finally the result is returned as a variable named orderlines.

So to get all the entered fields sent to you in an email, you first add an email action after the loop.
Repeater forms image 5

As you can see, I start the body by building a table header, and then I place all the non-repeated fields in the email.
It is then continued like this

Repeater forms image 6
After all the 'non-repeated' fields I have placed the variable defined in the loop. And finally I end the table.

The result is a clearly understandable table placed in an email formatted in HTML, and most importantly, it WORKS!
Max_admin 18 Apr, 2019
Thank you!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 24 Apr, 2019
Hi frisbe,

Thanks, I've added this as a FAQ.

Bob
Max_admin 24 Apr, 2019
1 Likes
I want to add that the latest update has a "Model" field in the "Repeater" settings, that would be added automatically to all the fields inside the the repeater, so setting the repeater to Person and the fields name to name,email..etc the end result would be:
Person[0][name]
Person[0][email]
It will also auto update the fields ids for the validation to work correctly

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.