Buy Now
Sign in

FAQ search

How to use the repeater area

Details
Published: Saturday, 27 May 2017 03:43

The repeater area in v6 has 2 features, the old v5 multiplier feature + a new content repeating feature.

The repeating feature

You can place any number of elements inside the body box of the repeater area, and call an array variable in the "Data provider" to repeat the content times the number of the array elements.

This is usually used with "read data" results arrays, but any other array can be used, you can also pass an integer value and the content will be repeated for the range between 0 and that integer, so placing 4 will repeat the content 5 times.

The multiplier feature

Enable the Content multiplier feature in the repeater area then drag a button inside the "footer" box of the repeater, now open the button settings and add "multiply" to the "Class" field and save the form.

if the button does not have a class setting then you can add the following to the "Extra attributes" box: class:multiply

When clicking the button, it will clone the body area contents and add them to the form, the original body area content copy is hidden and can not be used.

Using -N- in the contents of the multiplier will be replaced by the current clone number, so for example having a field named name-N- will create fields named name0,name1,name2...etc

You may add another button and give it the class "remove", this button can then be used to remove the added clones.

The best field names format in the repeater is this format: Model[n][field_name], where "n" is a number, when submitting the form, an array of data sets can be processed easily using a Loop function and/or a "Save data" action.

Saving the multiplier data

Assuming the naming convention advised above has been used, a LOOP EVENT action can be used to get the data and run a "Save data" action one time for each multiplier clone created.

The Loop Event data provider should be set to {data:Model} which is the paremt of the cloned items data sets, and the "Save data" daat provider should be set to {var:switch_action_name.row}, the "Save data" should be inside the "Body" section of the "Loop event" action.