Buy Now
Sign in

Checkbox in a repeater

megana , February 22 2019, 22:48
M
megana 192
February 22 2019, 22:48 #384108
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 8
February 23 2019, 10:20 #384111
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?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
M
megana 192
February 25 2019, 15:06 #384176
The checkbox is called 'hide' with a checked value of 1 and a ghost value of 0.
M
megana 192
February 25 2019, 16:01 #384177
 1
 Answer
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
)