I am using ChronoForms for our educational institution and am trying to get a confirmation email to work. The email template excerpt looks like: (NOTE: the {x_Program} are radio button fields
Dear {name}:
Thank you for your registration to the Basic Skills Review for the following session(s):
{Sep_Program}
{Nov_Program}
{Jan_Program}
{Feb_Program}
{Apr_Program}
{Jun_Program}
{Jul_Program}
How can I get my results to leave the session fields blank if they are blank instead of returning an email that looks like:
Dear Diabolka:
Thank you for your registration to the Basic Skills Review for the following session(s):
Sep Math Session
{Nov_Program}
{Jan_Program}
Feb English Session
{Apr_Program}
Jun English Session
Both Jul Sessions
Thanks in advance for your time.
Dear {name}:
Thank you for your registration to the Basic Skills Review for the following session(s):
{Sep_Program}
{Nov_Program}
{Jan_Program}
{Feb_Program}
{Apr_Program}
{Jun_Program}
{Jul_Program}
How can I get my results to leave the session fields blank if they are blank instead of returning an email that looks like:
Dear Diabolka:
Thank you for your registration to the Basic Skills Review for the following session(s):
Sep Math Session
{Nov_Program}
{Jan_Program}
Feb English Session
{Apr_Program}
Jun English Session
Both Jul Sessions
Thanks in advance for your time.
Is this a known issue with radio entries in forms and chronoforms? There are no extraneous spacing in the radio field name. If not selected, I'd like not to have {field_name} listed in the email results. Please advise. Thanks in advance!
Hi diabolka,
It wasn't a bug that I knew of - but bug it is. It's a little tricky as an 'unchecked' checkbox returns nothing in the $_POST array. The ChronoForms mailer goes through the array and substitutes all the values it finds . . . but it doesn't find these.
If you add this code to the OnSubmit Before box it will check for the missing values and add them:
In your specific case you might want to look at using a Checkbox array instead of individual checkboxes (or radio buttons). ChronoForms will then work fine as long as at least one box is checked.
Bob
It wasn't a bug that I knew of - but bug it is. It's a little tricky as an 'unchecked' checkbox returns nothing in the $_POST array. The ChronoForms mailer goes through the array and substitutes all the values it finds . . . but it doesn't find these.
If you add this code to the OnSubmit Before box it will check for the missing values and add them:
<?php
$check_boxes = array (
'Sep_Program',
'Nov_Program',
'Jan_Program',
'Feb_Program',
'Apr_Program',
'Jun_Program',
'Jul_Program'
);
foreach ( $check_boxes as $v ) {
$check = JRequest::getVar($v, '', 'post');
if ( !$check ) {
JRequest::setVar($v, '', 'post');
}
}
?>
This is a general workaround and will be OK for checkboxes or radio boxes.In your specific case you might want to look at using a Checkbox array instead of individual checkboxes (or radio buttons). ChronoForms will then work fine as long as at least one box is checked.
Bob
Thank you, Bob. Yesterday, I went ahead and made it a checkbox array so now it doesn't list the empty options which was my goal. Thanks for your response!
Hi,
I have been able to successfully hide my empty checkboxes when I display my results using {fieldname} now. I couldn't get the custom code to work no matter where I placed it. But finally was able to with Max's suggestion of a hidden field with the same name.
Apryl
I have been able to successfully hide my empty checkboxes when I display my results using {fieldname} now. I couldn't get the custom code to work no matter where I placed it. But finally was able to with Max's suggestion of a hidden field with the same name.
Apryl
Hi apryl,
This is an old thread :-(
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6/1.7/2.5.
Does the ChronoForms array handler not do what you need?
Bob
This is an old thread :-(
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6/1.7/2.5.
Does the ChronoForms array handler not do what you need?
Bob
This topic is locked and no more replies can be posted.