Forums

Checkbox group email only one value

damconsulting 23 Mar, 2015
Hi, i'm using a checkbox group in my form with 6 possibilities but when i get the email, i only see the last choice selected.
I try to explain better:
[attachment=0]check.jpg[/attachment]
Even if i check two or more values, i'll obtain in my email only the last checked one.
I'have also insert "handle arrays" on submit just before email but without success.
The form is here
http://www.zerobugs.it/index.php/contatti#sono-un-operatore-professionale

and this is the html code:
<div class="form-group gcore-form-row" id="form-row-nomecognome"><label for="nomecognome" class="control-label gcore-label-left">Nome e Cognome</label>
<div class="gcore-input gcore-display-table" id="fin-nomecognome"><input name="nomecognome" id="nomecognome" value="" placeholder="" maxlength="" size="" class="validate['required'] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-hotel"><label for="hotel" class="control-label gcore-label-left">Hotel</label>
<div class="gcore-input gcore-display-table" id="fin-hotel"><input name="hotel" id="hotel" value="" placeholder="" maxlength="" size="" class="form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-citta"><label for="citta" class="control-label gcore-label-left">Città</label>
<div class="gcore-input gcore-display-table" id="fin-citta"><input name="citta" id="citta" value="" placeholder="" maxlength="" size="" class="form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-email"><label for="email" class="control-label gcore-label-left">E-mail</label>
<div class="gcore-input gcore-display-table" id="fin-email"><input name="email" id="email" value="" placeholder="" maxlength="" size="" class="validate['required','email'] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-telefono"><label for="telefono" class="control-label gcore-label-left">Telefono</label>
<div class="gcore-input gcore-display-table" id="fin-telefono"><input name="telefono" id="telefono" value="" placeholder="" maxlength="" size="" class="form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-interessi"><label for="interessi" class="control-label gcore-label-left gcore-label-checkbox">Sono interessato a</label>
<div class="gcore-input gcore-display-table" id="fin-interessi"><div class="gcore-single-column" id="fclmn"><div class="gcore-checkbox-item" id="fitem"><input name="interessi" id="interessi" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="Coprimaterassi" />
<label class="control-label gcore-label-checkbox" for="interessi">Coprimaterassi</label></div>
<div class="gcore-checkbox-item" id="fitem1"><input name="interessi" id="interessi1" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="Topper" />
<label class="control-label gcore-label-checkbox" for="interessi1">Topper</label></div>
<div class="gcore-checkbox-item" id="fitem2"><input name="interessi" id="interessi2" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="Copriguanciale" />
<label class="control-label gcore-label-checkbox" for="interessi2">Copriguanciale</label></div>
<div class="gcore-checkbox-item" id="fitem3"><input name="interessi" id="interessi3" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="AcarZeroBugs™ WALL" />
<label class="control-label gcore-label-checkbox" for="interessi3">AcarZeroBugs™ WALL</label></div>
<div class="gcore-checkbox-item" id="fitem4"><input name="interessi" id="interessi4" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="Visita agente di zona" />
<label class="control-label gcore-label-checkbox" for="interessi4">Visita agente di zona</label></div>
<div class="gcore-checkbox-item" id="fitem5"><input name="interessi" id="interessi5" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" value="altro (specificare)" />
<label class="control-label gcore-label-checkbox" for="interessi5">altro (specificare)</label></div></div></div></div><div class="form-group gcore-form-row" id="form-row-commenti"><label for="commenti" class="control-label gcore-label-left">Commenti</label>
<div class="gcore-input gcore-display-table" id="fin-commenti"><textarea name="commenti" id="commenti" placeholder="" rows="2" cols="40" class="form-control A" title="" style="" data-wysiwyg="0" data-load-state="" data-tooltip=""></textarea></div></div><div class="form-group gcore-form-row" id="form-row-custom"><label for="custom" class="control-label gcore-label-left">privacy</label>
<div class="gcore-input gcore-display-table" id="fin-custom">Ho preso visione <a href="index.php?option=com_content&view=article&id=128&Itemid=1093" target="_blank">dell'informativa sulla privacy di ZeroBugs™</a> ed acconsento al trattamento dei miei dati personali allo scopo di processare la mia richiesta.</div></div><div class="form-group gcore-form-row" id="form-row-checkbox6"><div class="gcore-input gcore-display-table" id="fin-checkbox6"><div class="gcore-checkbox-item" id="fitem6"><input name="checkbox6" id="checkbox6" value="1" class="validate['required'] A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" />
<label class="control-label gcore-label-checkbox" for="checkbox6">Acconsento</label></div></div></div><div class="form-group gcore-form-row" id="form-row-button7"><div class="gcore-input gcore-display-table" id="fin-button7"><input name="button7" id="button7" type="submit" value="Invia" class="btn btn-default form-control A" style="" data-load-state="" /></div></div>


Any idea?
Thank you.
Max_admin 23 Mar, 2015
Hi emanuele,

Just add a "handle arrays" action above the "Email" action in your "submit" event area.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 23 Mar, 2015
1 Likes
Hi emanuele,

I see you already have the Handle Arrays action, please change the name of the Checkbox group to interessi[] with the [] at the end.

Bob
edkiefer 28 May, 2015
I have a checkbox group field named, literature_choice.
My options are:
WW trailer=Weekend Warrior Trailer
WW 5th wheel=Weekend Warrior 5th Wheel
Azur=Avion Azur Class B Motorhome
Strada=Avion Strada Luxury Touring

I have handle arrays above the email in on submit.
In the email template I have {literature_choice}
I only receive one result in my email no mater how many choice are checked. What am I doing wrong? Thanks
GreyHead 28 May, 2015
Hi edkiefer,

Please see my post immediately before yours and change the name to literature_choice[]

Bob
jmahun 05 Jun, 2015
I was running into the same problem but resolved it by adding the [] at the end of the variable name as you indicated.
What about when I want to retrieve data to populate the form? In DB Read if I use [] at the end of the respective field names and test the form, I get a 1054 - Unknown Column error.
GreyHead 05 Jun, 2015
Hi jmahun,

Please drag a Handle Arrays action into the OnSubmit event and move it up before the DB Save action.

Bob
jmahun 05 Jun, 2015
Wait, now I'm confused.
I'm using two forms, one to collect date, the second to show data pulled from the database.
In the first form I have a Handle Array before my DB Save action.That appears to work correctly.
In the second form I have a DB Read action to pull the data. Do you mean I should add a Handle Arrays action here also?
GreyHead 06 Jun, 2015
Hi jmahun,

We'll get there . . .

The Handle Arrays action converts an array to a string so you need it before a DB Save or Email.

When you re-load the data with a DB Read you need to convert a string back into an array. In CFv4 the DB Record Loader action could do that for specified columns. Unfortunately it seems to have got lost in CFv5 so you need to use a Custom Code action instead
<?php
$form->data['column_name'] = explode(', ', $form->data['column_name']);
?>
assuming that you have used comma+space as the string separator.

Bob
jmahun 06 Jun, 2015
Thanks, that helps a lot!
JM
LikeStuff 19 Oct, 2015
This post was very helpful - thanks.

Is there a way to add a space or a return between the choices that come into the email they come in like the below, with no space between the selection:

Meeting Date(s): October 22,November 19

Thank you!
GreyHead 20 Oct, 2015
Hi LikeStuff,

Use comma+space as the string separator in the Handle Arrays action.

Bob
LikeStuff 21 Oct, 2015
Hi Greyhead,

Thank you!
Renaat 18 Jan, 2016
I don't now where I have put the [] to receive the different choises of the checkbox in the email.
This is how it is now:

type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-artikelen"><label for="artikelen" class="control-label gcore-label-left gcore-label-checkbox">Staat op beurs met:</label>
<div class="gcore-input gcore-display-table" id="fin-artikelen"><div class="gcore-multiple-column" id="fclmn1"><div class="gcore-checkbox-item" id="fitem2"><input name="artikelen" id="artikelen" class="validate['group:10'] A" title="" style="" data-load-state="" data-tooltip="Geef aan met wat u op de beurs staat" type="checkbox" value="Hagedissen" />
<label class="control-label gcore-label-checkbox" for="artikelen">Hagedissen</label></div>
<div class="gcore-checkbox-item" id="fitem3"><input name="artikelen" id="artikelen1" class="validate['group:10'] A" title="" style="" data-load-state="" data-tooltip="Geef aan met wat u op de beurs staat" type="checkbox" value="Slangen" />
<label class="control-label gcore-label-checkbox" for="artikelen1">Slangen</label></div>
<div class="gcore-checkbox-item" id="fitem4"><input name="artikelen" id="artikelen2" class="validate['group:10'] A" title="" style="" data-load-state="" data-tooltip="Geef aan met wat u op de beurs staat" type="checkbox" value="Amfibieën" />
<label class="control-label gcore-label-checkbox" for="artikelen2">Amfibieën</label></div>
<div class="gcore-checkbox-item" id="fitem5"><input name="artikelen" id="artikelen3" class="validate['group:10'] A" title="" style="" data-load-state="" data-tooltip="Geef aan met wat u op de beurs staat" type="checkbox" value="Voedseldieren" />
<label class="control-label gcore-label-checkbox" for="artikelen3">Voedseldieren</label></div>
<div class="gcore-checkbox-item" id="fitem6"><input name="artikelen" id="artikelen4" class="validate['group:10'] A" title="" style="" data-load-state="" data-tooltip="Geef aan met wat u op de beurs staat" type="checkbox" value="Materiaal" />
<label class="control-label gcore-label-checkbox" for="artikelen4">Materiaal</label></div></div></div></div><div class="form-group gcore-form-row"
GreyHead 18 Jan, 2016
Hi Renaat,

The Checkbox group name needs to end in [] e.g. artikelen[]

Bob
Renaat 01 Feb, 2016
Hey Bob,
I placed the [] here:
input name="artikelen[]" id="artikelen"
but after saving the form, and I cheque it again the [] is no longer there???
what can I do wrong?

Renaat
GreyHead 01 Feb, 2016
Hi jmahun,

Where exactly did you put it?

Normally you'd change the element settings in the Designer tab. If you changed the code in the Code tab that will be ignored (unless you choose to set the Form Type there to Custom - which I don't recommend).

Bob
Renaat 02 Feb, 2016
Hi Bob,
I tried it in the Code Tab, that don't work as you say. When I did it in the Designer tab, olso no result, so I deleted it and made a new checkbox group, and than it worked.
Thank you for the help.
Now gonne trie to insert a database and make that work
And searching to make the form in different languages.
Are there topics for?
Thank you very mutch

Renaat
GreyHead 02 Feb, 2016
Hi Renaat,

Please see the section on Locales at the end of this FAQ

Bob
albs 15 Mar, 2016
Hi GreyHead,

Can this work for Google Spreadsheet saves too? Currently, I have a field called GSheet[Training], do I change this to GSheet[Training][]?

Thanks!
Albert
GreyHead 15 Mar, 2016
Hi Albert,

Yes if it is a CheckBox group or a Multiple DropDown select.

Bob
This topic is locked and no more replies can be posted.