Hi all,
I've got a couple issues concerning how the form results are displayed in the emails sent upon SUBMIT.
I'm running J! 1.6, CF4 RC 1.9.
1) Check Box Group formatting
I have an optional Check Box Group field. When left blank (e.g. neither selection is checked), in the email results it shows {my_field_name}, as opposed to nothing like all the other optional fields when left blank.
When one of the check boxes is checked, or both, the email displays both answers properly.
Any idea on how to fix that?
2) Date/Time Picker
I was fortunately able to figure out how to get my Form to display dates from the datePicker the standard US way (m-d-Y). However the email results still appear as Y-m-d H:m:s.
I'd like for the email results to display like this: 12-01-2011, 2:00PM
What file is responsible for formatting the datePicker data? I've looked everywhere and tried adjusting various fields in both the datepicker.js and .php files through trial and error, and haven't found one that appears to work.
I've got a couple issues concerning how the form results are displayed in the emails sent upon SUBMIT.
I'm running J! 1.6, CF4 RC 1.9.
1) Check Box Group formatting
I have an optional Check Box Group field. When left blank (e.g. neither selection is checked), in the email results it shows {my_field_name}, as opposed to nothing like all the other optional fields when left blank.
When one of the check boxes is checked, or both, the email displays both answers properly.
Any idea on how to fix that?
2) Date/Time Picker
I was fortunately able to figure out how to get my Form to display dates from the datePicker the standard US way (m-d-Y). However the email results still appear as Y-m-d H:m:s.
I'd like for the email results to display like this: 12-01-2011, 2:00PM
What file is responsible for formatting the datePicker data? I've looked everywhere and tried adjusting various fields in both the datepicker.js and .php files through trial and error, and haven't found one that appears to work.
Hi idyllwyld,
Unchecked checkboxes return nothing at all when the form is submitted so ChronoForms ahs no way of knowing what to look for. Drag a custom code action to the OnSubmit Event, move it before the Email action and put this code in it:
The datepicker has two different format options: 'format' sets the display format and 'inputOutputFormat' sets the format used for saving and loading. This measn that you can have a user friendly display but use a computer friendly format like a Unix Timestamp to save.
Bob
Unchecked checkboxes return nothing at all when the form is submitted so ChronoForms ahs no way of knowing what to look for. Drag a custom code action to the OnSubmit Event, move it before the Email action and put this code in it:
<?php
$my_input_name = JRequest::getString('my_input_name', '', 'post');
JRequest::setVar('my_input_name', $my_input_name);
?>
The datepicker has two different format options: 'format' sets the display format and 'inputOutputFormat' sets the format used for saving and loading. This measn that you can have a user friendly display but use a computer friendly format like a Unix Timestamp to save.
Bob
Bob,
Thanks for the reply. I tried adding the custom code as instructed, however I'm still getting the same issue. I've tried setting the custom code event to either Controller or View mode, but there doesn't appear to be any difference. I even put it above the DB Save event, so it is well before the Email event.
When you say, "my_input_name" in that code are you referring to the field name, or the field ID?
As for datePicker, I presume you mean to put that code in the DateTime Picker config field under the General tab. I just need to change the display format, so 'format' sounds like what I want. What's the proper syntax for that? Is it just
Thanks for the reply. I tried adding the custom code as instructed, however I'm still getting the same issue. I've tried setting the custom code event to either Controller or View mode, but there doesn't appear to be any difference. I even put it above the DB Save event, so it is well before the Email event.
When you say, "my_input_name" in that code are you referring to the field name, or the field ID?
As for datePicker, I presume you mean to put that code in the DateTime Picker config field under the General tab. I just need to change the display format, so 'format' sounds like what I want. What's the proper syntax for that? Is it just
formatDate( ' m-d-Y ' )
Hi idylwylld,
Apologies, in CFv4 it needs to be slightly different:
Bob
Apologies, in CFv4 it needs to be slightly different:
<?php
$my_input_name = JRequest::getString('my_input_name', '', 'post');
$form->data['my_input_name'] = $my_input_name;
?>
Bob
Bob,
When neither checkbox is selected the email result is blank, as it should be. But when either or both options are checked the email result prints "Array".
For context, I'm running the custom code in Controller Mode, and where you've indicated "my_input_name" I am using the element's "Field Name".
When neither checkbox is selected the email result is blank, as it should be. But when either or both options are checked the email result prints "Array".
For context, I'm running the custom code in Controller Mode, and where you've indicated "my_input_name" I am using the element's "Field Name".
Hi idyllwyld ,
Use the Handle Array action to covert the array to a string for email or saving.
Bob
Use the Handle Array action to covert the array to a string for email or saving.
Bob
Bob,
I already have the Handle Arrays event, it's at the very top of OnSubmit.
I already have the Handle Arrays event, it's at the very top of OnSubmit.
Just an update...
I've figured out the date issue, and documented by steps along the way. I could share it if people want.
However I'm still slightly perplexed by the Checkbox email results...
I've added the 'Handle Arrays' action to OnSubmit, and set it well above the 'Email' action.
I've also added a 'Custom Code' action before the 'Email' action, but after the 'Handle Arrays'. It is in "Controller" mode.
As Bob instructed, the code is:
When I get the email form results the field is blank when no boxes are checked (as appropriate), however if I check one or both boxes the email results says "Array". Any thoughts?
I've figured out the date issue, and documented by steps along the way. I could share it if people want.
However I'm still slightly perplexed by the Checkbox email results...
I've added the 'Handle Arrays' action to OnSubmit, and set it well above the 'Email' action.
I've also added a 'Custom Code' action before the 'Email' action, but after the 'Handle Arrays'. It is in "Controller" mode.
As Bob instructed, the code is:
<?php
$apply_mail_direct = JRequest::getString('apply_mail_direct', '', 'post');
$form->data['apply_mail_direct'] = $apply_mail_direct;
?>
When I get the email form results the field is blank when no boxes are checked (as appropriate), however if I check one or both boxes the email results says "Array". Any thoughts?
Hi idyllwyld,
If the original issue is that you have the {field_name} text when the field is not checked then you may add a hidden field with the SAME name BEFORE the checkboxes in the form and this should take care of the place holder if no checkboxes of that group were checked.
Regards,
Max
If the original issue is that you have the {field_name} text when the field is not checked then you may add a hidden field with the SAME name BEFORE the checkboxes in the form and this should take care of the place holder if no checkboxes of that group were checked.
Regards,
Max
I added the hidden fields directly into the form's HTML like this:
But when I test the form with both boxes unchecked the email results display both selections ("In Person", "By Mail") as if both had been checked.
<div class="ccms_form_element cfdiv_checkboxgroup" id="apply_by_mail_or_direct_container_div"><label for="input_apply_mail_direct">Apply by Mail or Direct</label>
<input type="hidden" name="apply_mail_direct[]" id="apply_mail_direct_in_person" title="" value="In Person" class=""><input type="checkbox" name="apply_mail_direct[]" id="apply_mail_direct_in_person" title="" value="In Person" class="">
<label for="apply_mail_direct_in_person">In Person</label>
<input type="hidden" name="apply_mail_direct[]" id="apply_mail_direct_by_mail" title="" value="By Mail" class="">
<input type="checkbox" name="apply_mail_direct[]" id="apply_mail_direct_by_mail" title="" value="By Mail" class="">
<label for="apply_mail_direct_by_mail">By Mail</label>
But when I test the form with both boxes unchecked the email results display both selections ("In Person", "By Mail") as if both had been checked.
Hi,
You need only 1 hidden field with the name "apply_mail_direct" (no square brackets) before any checkboxes
Regards,
Max
You need only 1 hidden field with the name "apply_mail_direct" (no square brackets) before any checkboxes
Regards,
Max
It all works properly now! Thanks a lot Max.
Here's my final working code for anyone else to reference if they run into a similar problem:
Here's my final working code for anyone else to reference if they run into a similar problem:
<div class="ccms_form_element cfdiv_checkboxgroup" id="apply_by_mail_or_direct_container_div">
<label for="input_apply_mail_direct">Apply by Mail or Direct</label>
<input type="hidden" name="apply_mail_direct" id="apply_mail_direct" title="" value="" class="">
<input type="checkbox" name="apply_mail_direct[]" id="apply_mail_direct_in_person" title="" value="In Person" class="">
<label for="apply_mail_direct_in_person">In Person</label>
<input type="checkbox" name="apply_mail_direct[]" id="apply_mail_direct_by_mail" title="" value="By Mail" class="">
<label for="apply_mail_direct_by_mail">By Mail</label>
<div class="clear"></div><div id="error-message-apply_mail_direct"></div></div>
This topic is locked and no more replies can be posted.