Buy Now
Sign in

Checkbox Values in Email

mariokrupik , May 02 2011, 12:49
mariokrupik 64
May 02 2011, 12:49 #69014

I am having troubles with an existing Form and it's Checkbox Selections.

There are 6 different checkboxes - like:
<input name="gutscheinart3" type="checkbox" class="schriftgrau" id="gutscheinart3" value="Panoramaflight">

In the Email, if I add all {gutscheinart3} - {gutscheinart4} - ...
next to each other, I do get the value for each Checkbox marked, but all others are shown as written in the template: {gutscheinart3}

As the customer will get a confirmation, I hope that someone can help me with that.
I have looked through the Forum, and found something about the Array Handler, but this seems only to effect Checkbox Groups.

GreyHead 64
May 02 2011, 14:31 #69018
Hi mariokrupik,

A checkbox group is a common way of handling linked checkboxes, in that case the code would be like
<input name="gutscheinart
  • " type="checkbox" class="schriftgrau" id="gutscheinart3" value="Panoramaflight">
    <input name="gutscheinart
  • " type="checkbox" class="schriftgrau" id="gutscheinart4" value="EinAndereflight">

    For this you need to use the Handle Array feature to convert the array result into a string.

    For the separate checkboxes that you have the problem is that an unchecked box returns nothing at all so there is no value. This means that you need to add the code to identify the missing results and add them. Typically you use something like this in the OnSubmit Before Box for each checkbox:
    $gutscheinart3 = JRequest::getString('gutscheinart3', '', 'post');
    JRequest::setVar('gutscheinart3', $gutscheinart3);

    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much
    mariokrupik 64
    May 02 2011, 15:28 #69021
    Awesome, thank you
    kale 1
    May 04 2011, 12:17 #69151
    Here is my easy solution for a form with one checkbox. Add the following php line to your email template (remember NOT to use it in editor mode):

    <?php echo JRequest::getVar('checkboxname', '0', 'post'); ?>

    Where checkboxname is the input name of the checkbox in your form. 0 is the value you want to show in the email if the checkbox was not checked.

    I tried the solutions found in this forum but still couldn't get it working. After fighting with the problem for couple of hours I came up with the solution above.

    Hope this helps!