Forums

Multi choice checkbox group

margknox 10 Jun, 2019
In a checkbox group, how do I enable selection of more than one item? I've tried adding an array handler to the on-submit, but that makes no difference.
Thank you.
healyhatman 10 Jun, 2019
Don't know about v5 but you could either just do it in v6 OR add multiple checkboxes.
GreyHead 11 Jun, 2019
Hi margknox,

Please check that the Checkbox group has an array name ending in []

Bob
margknox 18 Jun, 2019
Thank you Bob. I don't see an array name at all, where do I look for it?

This is the debugger report...


Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => ordercssa
[event] => submit
[Name] => Margory
[Email] => margknox@optusnet.com.au
[Delivery] => Testing form, What is the array name?
[Items] => Maintain-Sound-Mind
[g-recaptcha-response] => 03AOLTBLSPu1X8U-9Ejl3SPQUPZKvv4k7aH1JEGMApyQFtbTIutevOw2B-VEyhu6cNYA0YGHljz3QZKgQ_kqlbxqKmHvdoEH2tT_yLME0ZnoqTpNDWzhLyrRMM_1UoL89ndZ4vX5YjISJdMdzaTqcuNEqUUG2eI6wrWCankXEtfJFIB3taRQx3TFpnrz9SO34bLXBnHh9kq8n7Vm5mOWu3Z4JlYAaS1VDzPyidkFPSbo9DmovC2AREv6cQt2_y6nQm_GcWZCo92-q4n8LYpud5W-uTKiAOIi0r_aorluiJODMMcYLycboHL7DggzRd4LZp6-R_INIP4QRd
[button6] => Submit
[cf_id] => 1
[ip_address] => 103.66.28.32
)
Array
(
)

Errors
Array
(
)

Debug Info
Array
(
[5] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `qwvde_cf_ordercssa` (`Name`, `Email`, `Delivery`, `Items`, `user_id`, `uniq_id`, `created`) values ('Margory', 'margknox@optusnet.com.au', 'Testing form, What is the array name?', 'Maintain-Sound-Mind', '0', 'fd407fc4a120f24681be15659926690a48b8f754', '2019-06-18 05:04:08');
)

)

)

[7] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:info@xxx.com
[2] => Subject:Order from CSSSA website
[3] => From name:Christadelphian Support Service SA
[4] => From email:contact@xxx.org
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)

[11] => Body:
[h2]Order Form[/h2]



















[table][tbody][tr][td]Name[/td][td]Margory[/td][/tr][tr][td]Email[/td][td]margknox@xxx.com[/td][/tr][tr align="left" valign="top"][td]Delivery Address[/td][td]Testing form, What is the array name?[/td][/tr][tr][td]Items Required[/td][td]Maintain-Sound-Mind[/td][/tr][/tbody][/table]

IP: 103.66.28.32
)

)

)
healyhatman 18 Jun, 2019
array name as in an array-like name as in just put square brackets at the end like myfield[]
margknox 18 Jun, 2019
Thank you healyhatman. I added the square brackets to the checkbox group name as in Items[]
but the debugger returned the error message:
1054 - Unknown column 'Array' in 'field list'
healyhatman 18 Jun, 2019
You probably have a database read based off of the selection, or a save data action? What is it?
margknox 19 Jun, 2019
It's a Database Save action. Multi save was set to No. When I set it to Yes, the report email returned all items selected, but in the following format:
array ( 0 => 'OneItem', 1 => 'OtherItem', 2 => 'AnotherItem',)
Presumably because my form hasn't submitted a "numerically indexed list of records." It's just the Yes=Yes, No=No format.
How do I numerically index my list please?
Thank you for your help.
margknox 20 Jun, 2019
I have moved the Handle Arrays action above everything else in On Submit, and the report email now lists the selected items without code:
OneItem, Otheritem, Anotheritem.
Much better, but still a horizontal list. How can I get the selected items to list vertically? Is that what a numerically indexed list does?
GreyHead 20 Jun, 2019
Hi margnox,

You can change the list separator in the Handle Arrays action. Or you can use some custom PHP+HTML to handle the display of that element.

Bob
margknox 20 Jun, 2019
Thank you Bob, I made the delimiter <br /> and now the items are listing fine.
But I now find that the test email records since the Multi Save has been Yes are not being saved to the database. What do I need to change here?
GreyHead 21 Jun, 2019
Hi margknox,

Please add a Debugger action to see what MySQL query is being creates. It may be that the new <br />s are breaking the query.


Bob
margknox 21 Jun, 2019
Thank you Bob. I don't think changing the separator caused the problem. because no test emails have been saved since changing the Multi Save from No to Yes.
Here's the Debugger output:









Data Array
Array
(
    [option] => com_chronoforms5
    [chronoform] => ordercssa
    [event] => submit
    [Name] => Millicent
    [Email] => margknox@optusnet.com.au
    [Delivery] => 
    [Items] => Depress-Positive-Steps<br />Forgiveness-David-Hill<br />Cope-Tough-Times-Youth<br />Cope-Tough-Times-Parents
    [g-recaptcha-response] => 03AOLTBLSA9RxY66URAq7y1KvCPazGy88VzKdZsMoqjFkaYcQUF0WQ9Fw3tYAML782dsXGSLL458FLcJLlQzxcXxl-21UdLOOjHy-o5d2hb2QFD4K0-FYSxw-rUbCdMkCQ62_CTx5KPutmS0cGnEIZfJT9F8nxuISrs8VE07bvfiI-VSvubKZ4PBmqq4hcWQplsofm22dTNr0-LeQUfnPWBMFndgcllwJ8W2Vdh_3VwURfAroGoPmwB-D7akua2FwfPDpsMeYTKJeF7I3EpTjOM_zI6eGXiaFANcs1N5adIQIWBjdbYqTahrRrQDaS0gDFmSEpuh0lHv0z
    [button6] => Submit
    [cf_id] => 0
    [ip_address] => 103.66.28.31
)
Array
(
)

Errors
Array
(
)

Debug Info
Array
(
    [5] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                        )

                )

        )

    [7] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:info@marblebon.com.au
                    [2] => Subject:Order from CSSSA website
                    [3] => From name:Christadelphian Support Service SA
                    [4] => From email:contact@supportnetwork.org.au
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
<h3>Order from CSSSA Website:</h3>
<table>
<tbody>
<tr>
<td>Name:</td>
<td>Millicent</td>
</tr>
<tr>
<td>Email:</td>
<td>margknox@optusnet.com.au</td>
</tr>
<tr>
<td valign="top">Ecclesia/Delivery Preference:&nbsp;</td>
<td></td>
</tr>
<tr>
<td valign="top">Items Required:&nbsp;&nbsp;</td>
<td>Depress-Positive-Steps<br />Forgiveness-David-Hill<br />Cope-Tough-Times-Youth<br />Cope-Tough-Times-Parents</td>
</tr>
</tbody>
</table><br /><br />IP: 103.66.28.31
                )

        )

)
healyhatman 21 Jun, 2019
Are you still getting the unknown column array message
margknox 23 Jun, 2019
Thanks healyhatman, No, that message disappeared when I changed the MultiSave from No to Yes. There's been no error message since then, and the admin email is fine.
The only problem is that the messages are not saving to the database, and haven't been since I changed the MultiSave.
This topic is locked and no more replies can be posted.