Buy Now
Sign in

Repeating content starting index = 1

davideiandoli75 , July 03 2017
Answered
D
davideiandoli75
I have got a field in which the user enters an integer number and I wish my repeater area displays the group of fields according to this.

Example: If I put "2" in number in first page I'll see 2 groups of fields in the second page. Is this possible? How?

Actually using {data:numero} shortcode I get always one group more than my needs, since the array starting index is 0.

Thanks a lot
admin
Hi Davide,

You are using the correct syntax, and yes, if the provider is an integer then the repeater will create an array of elements between 0 and that integer, so you need to decrement that number before its used in the repeater's provider.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
D
davideiandoli75
Ok. I tried to do this by dragging a "Modify data" action in the second part of form, after "Multipage" and before "display section". I set "Data provider" as {data:numero], and then I tried to write in "Data override" this little snippet:

<?php
$this->data['numero'] = $this->data['numero'] - 1;
?>


and then I solved

Thanks a lot