I added a simple checkbox.
But when the email results come in, the name of the item they checked is repeated twice.
Is that how it works?
Example, I have "Choose all that apply:"
And the checkbox choices are:
O carrots
O peas
O fruit
O cows
Well if the person chose peas, then this is what I see in the email I get sent:
carrots
peas peas
fruit
cows
Note the two instances of peas?
What am I doing wrong?
Thanks,
cra2
But when the email results come in, the name of the item they checked is repeated twice.
Is that how it works?
Example, I have "Choose all that apply:"
And the checkbox choices are:
O carrots
O peas
O fruit
O cows
Well if the person chose peas, then this is what I see in the email I get sent:
carrots
peas peas
fruit
cows
Note the two instances of peas?
What am I doing wrong?
Thanks,
cra2
Hi cra2,
There's nothing wrong. The first 'peas' is the name of the field and the second is the 'value' of the field. If you set the values to 'OK' then you'll get 'peas OK' in the output.
Bob
There's nothing wrong. The first 'peas' is the name of the field and the second is the 'value' of the field. If you set the values to 'OK' then you'll get 'peas OK' in the output.
Bob
I will try that, thanks.
And that may suffice for now.
But out of curiousity, is there an easy way to only have the choices the user selected show up in the email?
So if they chose carrots and cows from the following list of checkboxes...
O carrots
O peas
O fruit
O cows
...all I would see in the email would be:
carrots
cows
?
Cra2
And that may suffice for now.
But out of curiousity, is there an easy way to only have the choices the user selected show up in the email?
So if they chose carrots and cows from the following list of checkboxes...
O carrots
O peas
O fruit
O cows
...all I would see in the email would be:
carrots
cows
?
Cra2
what do you have in the email template ? you need to put in the email template this : {field_name}, if the template was generated automatically then you may need to tweak it alittle bit!
Regards
Max
Regards
Max
Hi cra2,
I think that if you give all the members of the checkbox group the same array name e.g. 'ingredients[]' and set the values of the individual checkboxes to the ingredient names then you will get a result like:
ingredients peas,cows,fruit
Bob
I think that if you give all the members of the checkbox group the same array name e.g. 'ingredients[]' and set the values of the individual checkboxes to the ingredient names then you will get a result like:
ingredients peas,cows,fruit
Bob
Max,
I just have the default email template.
I'm just using chronocontact out of the box.
So, by default, when I chose checkbox from the wizard, that's how it set it up for me (like I posted at the top of this thread).
I've followed Grey's instructions and gone back in via the Form Code box and changed the values so that they all contain the word "Need."
That way, when we get an email, it looks like this;
Services Requested:
Need Cows
Peas
Need Bananas
Frogs
That tells us that they "need" cows and bananas out of the 4 items.
But it would be clearer if I could just drop the unchecked choices such that it just said;
Services Requested:
Cows
Bananas
Grey, I'm not 100% sure how to set the array name but I'll give it a shot.
I think I get what you're saying.
Thanks both of you.
I just have the default email template.
I'm just using chronocontact out of the box.
So, by default, when I chose checkbox from the wizard, that's how it set it up for me (like I posted at the top of this thread).
I've followed Grey's instructions and gone back in via the Form Code box and changed the values so that they all contain the word "Need."
That way, when we get an email, it looks like this;
Services Requested:
Need Cows
Peas
Need Bananas
Frogs
That tells us that they "need" cows and bananas out of the 4 items.
But it would be clearer if I could just drop the unchecked choices such that it just said;
Services Requested:
Cows
Bananas
Grey, I'm not 100% sure how to set the array name but I'll give it a shot.
I think I get what you're saying.
Thanks both of you.
Hi cra2,
If you copy and paste the 'checkbox' part of your form html here then I can edit it for you.
Bob
If you copy and paste the 'checkbox' part of your form html here then I can edit it for you.
Bob
here is the copy right from the Form Code tab.
<div class="form_element cf_checkbox"><label class="cf_label">Check All That Apply:</label><div class="float_left"><input value="Need " class="radio" id="Interior" name="Interior" type="checkbox"><label for="Interior" class="check_label">Interior</label><br><input value="Need " class="radio" id="Exterior" name="Exterior" type="checkbox"><label for="Exterior" class="check_label">Exterior</label><br><input value="Need " class="radio" id="Residential" name="Residential" type="checkbox"><label for="Residential" class="check_label">Residential</label><br><input value="Need " class="radio" id="Commercial" name="Commercial" type="checkbox"><label for="Commercial" class="check_label">Commercial</label><br><input value="Need " class="radio" id="Other" name="Other" type="checkbox"><label for="Other" class="check_label">Other</label><br></div></div>
Hi cra2,
Try this - I think it should be OK:
Bob
Try this - I think it should be OK:
<div class="form_element cf_checkbox">
<label class="cf_label">Check All That Apply:</label>
<div class="float_left">
<input value="Interior" class="radio" id="Interior" name="need[]" type="checkbox" />
<label for="Interior" class="check_label">Interior</label><br />
<input value="Exterior" class="radio" id="Exterior" name="need[]" type="checkbox" />
<label for="Exterior" class="check_label">Exterior</label><br />
<input value="Residential" class="radio" id="Residential" name="need[]" type="checkbox" />
<label for="Residential" class="check_label">Residential</label><br />
<input value="Commercial" class="radio" id="Commercial" name="need[]" type="checkbox" />
<label for="Commercial" class="check_label">Commercial</label><br />
<input value="Other" class="radio" id="Other" name="need[]" type="checkbox" />
<label for="Other" class="check_label">Other</label><br />
</div>
</div>
Bob
Hi cra2,
I'm not sure also If I understand what you need to do here but, are you trying to let users select multiple checkboxes ? I see you are using Radios ? show me a screenshot of your form and tell me what you need to do, Radios are for single selection, checkboxes are for multiple selections! then we can see how to fix your email results thing!
Regards
Max
I'm not sure also If I understand what you need to do here but, are you trying to let users select multiple checkboxes ? I see you are using Radios ? show me a screenshot of your form and tell me what you need to do, Radios are for single selection, checkboxes are for multiple selections! then we can see how to fix your email results thing!
Regards
Max
Hi Bob, Oh I see, I think I didn't check this well when I replied!
Thanks!
Max
Thanks!
Max
Hi Max,
No problem - I do that all the time :-) Too many postings to remember all the details.
Bob
No problem - I do that all the time :-) Too many postings to remember all the details.
Bob
hey bob,
thanks for your advice so far.
I pasted in your code and tested it and the result was this:
In other words, all options show up in the email, not the two I had selected.
thanks for your advice so far.
I pasted in your code and tested it and the result was this:
Service(s) Needed:
* {Interior}Interior
* {Exterior} Exterior
* {Residential} Residential
* {Commercial} Commercial
* {Other} Other
In other words, all options show up in the email, not the two I had selected.
Hi cra2,
That does look odd. Please will you post the checkbox section from your form html and from your email template so we can take a look at it all together.
Bob
That does look odd. Please will you post the checkbox section from your form html and from your email template so we can take a look at it all together.
Bob
all you need to add in your template code is {need} and remove any other code regarding those checboxes!
Hi Bob
This is just a short post to say that I am experiencing very similar behaviour to cra2 with my checkboxes in emails - even using your code - all the fields are repeated and no indication of which ones are ticked.
e.g. I get:-
{need} Interior
{need} Exterior
{need} Residential
{need} Commercial
{need} Other
I'm a definite newbie with CF but it looks a great product; just wish I could get this part of it working! :-)
I'll leave some time for cra2 to submit code; if not I'd be happy to post mine.
Jim
This is just a short post to say that I am experiencing very similar behaviour to cra2 with my checkboxes in emails - even using your code - all the fields are repeated and no indication of which ones are ticked.
e.g. I get:-
{need} Interior
{need} Exterior
{need} Residential
{need} Commercial
{need} Other
I'm a definite newbie with CF but it looks a great product; just wish I could get this part of it working! :-)
I'll leave some time for cra2 to submit code; if not I'd be happy to post mine.
Jim
Hi Jim,
Please post your code here - both the form html (or the checkbox part of it) and the matchng email template. It would be good to get this cracked.
Bob
Please post your code here - both the form html (or the checkbox part of it) and the matchng email template. It would be good to get this cracked.
Bob
Thanks Bob
Here's the Form Code:-
And the email template code:-
Jim
Here's the Form Code:-
<div class="form_element cf_checkbox">
<label class="cf_label">Check All That Apply:</label>
<div class="float_left">
<input value="Interior" class="radio" id="Interior" name="need[]" type="checkbox" />
<label for="Interior" class="check_label">Interior</label><br />
<input value="Exterior" class="radio" id="Exterior" name="need[]" type="checkbox" />
<label for="Exterior" class="check_label">Exterior</label><br />
<input value="Residential" class="radio" id="Residential" name="need[]" type="checkbox" />
<label for="Residential" class="check_label">Residential</label><br />
<input value="Commercial" class="radio" id="Commercial" name="need[]" type="checkbox" />
<label for="Commercial" class="check_label">Commercial</label><br />
<input value="Other" class="radio" id="Other" name="need[]" type="checkbox" />
<label for="Other" class="check_label">Other</label><br />
</div>
<div class="form_element cf_textbox">
<input value="Submit" name="undefined" type="submit">
</div>
</div>
And the email template code:-
<div class="form_element cf_checkbox"><label class="cf_label">Check All That Apply:</label>
<div class="float_left"><span>{need}</span> <label class="check_label" for="Interior">Interior</label><br /> <span>{need}</span> <label class="check_label" for="Exterior">Exterior</label><br /> <span>{need}</span> <label class="check_label" for="Residential">Residential</label><br /> <span>{need}</span> <label class="check_label" for="Commercial">Commercial</label><br /> <span>{need}</span> <label class="check_label" for="Other">Other</label><br /></div>
</div>
Jim
Should have added:- the code I posted gives the following email:-
Check All That Apply:
Interior, Residential, Other Interior
Interior, Residential, Other Exterior
Interior, Residential, Other Residential
Interior, Residential, Other Commercial
Interior, Residential, Other Other
Check All That Apply:
Interior, Residential, Other Interior
Interior, Residential, Other Exterior
Interior, Residential, Other Residential
Interior, Residential, Other Commercial
Interior, Residential, Other Other
Hi Jim,
Please change the template code to
Bob
Please change the template code to
<div class="form_element cf_checkbox"><label class="cf_label">Needs:</label><span>{need}</span></div>
Bob
Fantastic! :-)
I thought I had to let that code auto-generate!!
Yes that does the job very nicely indeed!
Thanks Bob - my $25 for the license will be on its way very shortly; that was the last thing I needed to solve before moving forward.
Jim
I thought I had to let that code auto-generate!!
Yes that does the job very nicely indeed!
Thanks Bob - my $25 for the license will be on its way very shortly; that was the last thing I needed to solve before moving forward.
Jim
Hi Jim,
Great, thank you. The email template generator code works well with input fields but is a bit dumb with radio & checkbox groups :-(
Bob
Great, thank you. The email template generator code works well with input fields but is a bit dumb with radio & checkbox groups :-(
Bob
Just getting back to this after taking a hiatus to work on something else.
Jim,
your form has the exact same options as mine?
(residential, commercial, etc)
Bob,
I pasted in the code you had suggested for Jim and the emailed results now look like:
Great! Just the two items I checked.
Now I just need to clean it up (spaces between Needs and Interior. Preferrably, actually a linebreak between the Needs and the items.
Thanks so much for your help!
Jim,
your form has the exact same options as mine?
(residential, commercial, etc)
Bob,
I pasted in the code you had suggested for Jim and the emailed results now look like:
Needs:Interior, Residential
Great! Just the two items I checked.
Now I just need to clean it up (spaces between Needs and Interior. Preferrably, actually a linebreak between the Needs and the items.
Thanks so much for your help!
Hi cra2,
at the on submit before email box add:
Max
at the on submit before email box add:
<?php
JRequest::setVar('your_field_name', implode('\n', JRequest::getVar('your_field_name')));
?>
Max
Max,
what will that do?
what will that do?
at the on submit before email box add:
Code: Select all
<?php
JRequest::setVar('your_field_name', implode('\n', JRequest::getVar('your_field_name')));
?>
Hi cra2,
That will add a line-break '/n' between each of the items. I'm not sure this is quite what you wanted. If you change the snippet I posted to:
Bob
That will add a line-break '/n' between each of the items. I'm not sure this is quite what you wanted. If you change the snippet I posted to:
<div class="form_element cf_checkbox"><label class="cf_label">Needs:</label><br />{need}</div>
it will put a line break between the heading row and the details row. You can put whatever html you want in here . . .Bob
I've followed this thread and it's been very helpful. But, I have one (hopefully simple) item outstanding - the email form works well, but when I create a table and set this to connect to the table and store the values, the field for this checkbox is blank - no data stored in mySQL for this field. The email is great, but I'll normally be working with an excel spreadsheet or other table of the data in this case - need the values to be in the database. Thoughts>?
I need to know the table structure and the checkbox code and the submitted data!
regards
Max
regards
Max
I need to know the table structure and the checkbox code and the submitted data!
regards
Max
I posted what I figured out here... take a look and I bet you'll find I've missed something obvious to you. I was unable to get any of it to work until I switched off the function to let ChronoForm handle the arrays and then put the db posting to happen after the email and put the implode code in the "code after email" field.
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=11555&p=19660#p19660
Hi peasea,
You should get the CheckBox value returned if the box is checked and an empty return if it isn't. If the checkbox doesn't have a value that I think you will get nothing at all.
Bob
You should get the CheckBox value returned if the box is checked and an empty return if it isn't. If the checkbox doesn't have a value that I think you will get nothing at all.
Bob
Hi Fomumae,
I also need linebreaks between the form output e-mail.
Could some-one please give me a hand.
http://www.farmad.be/index.php/NL/opleiding/lessen.html
If some-one enters locations for one lesson, the e-mail result looks like
Antwerpen op 28 april om 20 uurGent op 26 maart om 20 uur met personen.
while it should be :
Antwerpen op 28 april om 20 uur
Gent op 26 maart om 20 uur met personen.
thanks in advance.
I also need linebreaks between the form output e-mail.
Could some-one please give me a hand.
http://www.farmad.be/index.php/NL/opleiding/lessen.html
If some-one enters locations for one lesson, the e-mail result looks like
Antwerpen op 28 april om 20 uurGent op 26 maart om 20 uur met personen.
while it should be :
Antwerpen op 28 april om 20 uur
Gent op 26 maart om 20 uur met personen.
thanks in advance.
This topic is locked and no more replies can be posted.