How to convert email template for checkbox fields from 0/1 to no/yes - AS THE DEFAULT FOR CHECKBOXES IN A FORM FOR SUBMISSIONs/Emails

9 posts by 3 authors in: Forums > CMS Builder
Last Post: January 9, 2019   (RSS)

By Codee - January 1, 2019 - edited: January 2, 2019

Hello,

Person submits a form to the website and the form has several checkboxes for choices (just yes/no or check if yes).  Utilizing the email template function of CMSB...how do I handle the checkboxes when sending a confirmation email to the end users?  This is to avoid the end user (who submitted the form) from getting an email with several "1's" or "0's" in it. Thank you in advance.

How to convert email template for checkbox fields from 0/1 to no/yes

By gkornbluth - January 2, 2019 - edited: January 2, 2019

Hi Equinox,

Daniel Loewe helped me solve this issue when using an email template back in Nov in these posts:

https://www.interactivetools.com/forum/forum-posts.php?81459

https://www.interactivetools.com/forum/forum-posts.php?81463

Here's the body of my email template:

Hello #contact.firstName# #contact.lastName#,

Thanks for submitting your request to be included in the DBT Provider Directory.

The information you provided is below:

Practice Name: #practice#
Practice Address: #street# #room#, #city#, #state# #zip#

Practice Phone: #phone#

Contact Email: #contact.email#

You've indicated the following training/experience:

#training#

You've indicated that #more_than_one_location_for_practicea#

And that #more_than_one_practitioner_in_practicea#

You'll get another email from us after we've reviewed your request.

Best,

The DBT Provider Directory Team

I've also attached a copy of the form page that I set up.

Hope it helps,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

How to convert email template for checkbox fields from 0/1 to no/yes

By gkornbluth - January 2, 2019

Hi Equinox,

Just curious.

Do you create a different email template for each form?

Would there ever be a case where a checkbox is used for other than yes or no?

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

How to convert email template for checkbox fields from 0/1 to no/yes

By daniel - January 4, 2019

Hi Equinox,

This is a bit of a tricky problem, and unfortunately, in most cases, there is not going to be a way to change the values of submitted checkboxes in a way that doesn't require updating each individual form. There are some potential solutions that could work if some specific setup is done prior to creating the forms, but it's unlikely to work on existing forms.

It sounds like you might be using the Form Generator plugin to create the forms (or similar HTML), in which case the checkbox HTML should look something like this:

<div class="form-group">
  <label>Checkbox</label>
  <div>
    <input type='hidden' name='checkbox' value='0'>
    <input type='checkbox' name='checkbox' value='1' id='checkbox' <?php checkedIf('1', @$_REQUEST['checkbox']) ?>>
    <label for='checkbox' style='font-weight: normal'>checkbox</label>
  </div>
</div>

Probably the simplest thing you can do is change the value attribute here from 0/1 to no/yes, which will also update the submitted value.

I hope that's helpful - let me know if you have any more questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

How to convert email template for checkbox fields from 0/1 to no/yes

By Codee - January 8, 2019

Hi Daniel,

Thank you! Very simple, elegant and easy to instigate.

Cheers!

How to convert email template for checkbox fields from 0/1 to no/yes

By Codee - January 8, 2019

Hi Jerry,

Of course each site is unique but there is almost always something that can work more simply, more readily, more securely and more fun. ;-)  Most, or many, of the checkboxes I use will simply be a "yes/no" but there are plenty of examples where they might not be.  I guess the short of it, for me, is "it depends" and the dependent part is usually "depends upon what the client needs."

How to convert email template for checkbox fields from 0/1 to no/yes

By gkornbluth - January 8, 2019

Sounds right.

But it does unfortunately eliminate the possibility of a 'one size fits all' solution.

BTW, have you tried Daniel's idea?

Curious to see what you find when updating a check box with a text value, (or is that not how it works).

Anyway, if you find solutions, could you pass them on?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

How to convert email template for checkbox fields from 0/1 to no/yes

By Codee - January 9, 2019

Hi Jerry,

Actually I DID try it but it looks like the backend has to be changed from a checkbox to receiving input as well. (duh? right?)  On the current site I already came up with a different solution in the interim...I have a "fix it or eliminate it" mentality. Might seem simple-minded but eliminates a lot of headaches. ;-)