Forums

Checkbox in a repeater

megana 22 Feb, 2019
I'm having some problems with a checkbox in a repeater.

My form loads without any of the fields in the repeater showing. The user has to click a button to "add a row" in order to see the repeater fields. That all works great. The other fields in the repeater all work great. However, there is a checkbox in the repeater that misbehaves.

Below are two examples of what I'm seeing. Any ideas what I might be missing here?

(I tried to attach some screenshot of the form display and field settings, but I can't get any of my files or photos to attach here.)

Example 1:
I load the form and click the "add row" button twice to add two rows of my repeater fields. I fill out all the fields in both rows except the checkboxes. I only check the checkbox in the first row.

Debug output:
            [override] => Array
(
[0] => 1
[1] => 2
)

[skips] => Array
(
[0] => 1
[1] => 2
)

[hide] => 0

Example 2:
Same process, but this time I only check the checkbox in the second row.

Debug output:
            [override] => Array
(
[0] => 1
[1] => 2
)

[skips] => Array
(
[0] => 1
[1] => 2
)

[hide] => Array
(
[0] => 1
)
healyhatman 23 Feb, 2019
What's the problem exactly? What have you named your checkboxes, what have you got for the value? Which of the fields in the debug is the checkbox?
megana 25 Feb, 2019
The checkbox is called 'hide' with a checked value of 1 and a ghost value of 0.
megana 25 Feb, 2019
Answer
1 Likes
After walking away from it for a couple days and then coming back, I found my problem. I had the fields names as mygroup[hide][{var:area_repeater13.key}] instead of mygroup[{var:area_repeater13.key}][hide]. Once I renamed all the fields, that changed how my array looked in the results and also solved my checkbox problem.
            [0] => Array
                (
                    [override] => 1
                    [skips] => 1
                    [hide] => 1
                )

            [1] => Array
                (
                    [override] => 2
                    [skips] => 2
                    [hide] => 0
                )
This topic is locked and no more replies can be posted.