I am attempting to use the conditional email option using the Email [GH] action.
As I need to test the state of a number of variables prior to setting the condition, I have added a Custom Code action at the start of the On Submit event, per a tip I saw elsewhere in the forums. This is followed by the Email [GH] action.
It appears that the php code in the custom code action is not being executed. The SendEmail element is not being added to either form->array or form->debug.
The code included in the custom code action is as follows:
I added debug and stop actions after the email action to see what is going on. A sample debug dump is below. As you can see, SendEmail is not added to either array. The state of the variables in the above if statement should result in the creation of SendEmail = 1 condition.
Any thoughts as to why the custom code action would not execute? The custom code action is set to controller. The code syntax can't get much more basic, and I am not seeing any other errors.
I am running the following configuration:
php 5.4.10
mysql 5.5.29-log
Joomla 2.5.8
CF 4.0 RC3.5.2
CC 4.0 RC3.2
Thanks in advance for any help.
--
jeff
Debug output
As I need to test the state of a number of variables prior to setting the condition, I have added a Custom Code action at the start of the On Submit event, per a tip I saw elsewhere in the forums. This is followed by the Email [GH] action.
It appears that the php code in the custom code action is not being executed. The SendEmail element is not being added to either form->array or form->debug.
The code included in the custom code action is as follows:
<?php
if ( ($form->data['LodgeAdviserApprove'] != 1) && ($form->data['StaffAdviserApprove'] == 1) &&
($form->data['VCMPrevApprove'] != 1) )) {
$form->data['SendEmail'] = 1;
}
else {
$form->data['SendEmail'] = 0;
}
$form->debug['SendEmail'] = "This is the SendEmail Variable ". $form->data['SendEmail'];
?>
I added debug and stop actions after the email action to see what is going on. A sample debug dump is below. As you can see, SendEmail is not added to either array. The state of the variables in the above if statement should result in the creation of SendEmail = 1 condition.
Any thoughts as to why the custom code action would not execute? The custom code action is set to controller. The code syntax can't get much more basic, and I am not seeing any other errors.
I am running the following configuration:
php 5.4.10
mysql 5.5.29-log
Joomla 2.5.8
CF 4.0 RC3.5.2
CC 4.0 RC3.2
Thanks in advance for any help.
--
jeff
Debug output
Data Array:
Array
(
[Itemid] => 1071
[option] => com_chronoconnectivity
[task] => submit
[cb] => 6
[ReviewComments] =>
[StaffAdviserApprove] => 1
[StaffAdviserDate] =>
[LodgeAdviserApprove] => 0
[LodgeAdviserDate] =>
[CampingChairDate] =>
[NomineeFirstName] => Joe
[NomineeLastName] => Scouter
[NomineePosition] => Assistant Scoutmaster
[NominatorName] => Todd Smith
[NominatorUnitPosition] => Scoutmaster
[NominatingUnit] => 575
[NominationType] => Unit
[VCMPrevApprove] => 0
[Save] => Save
[cf_id] => 6
[cc_form_extension] => Array
(
[edit] => edit
)
[d7491ce87b6cd267eab6c14cae8f3810] => 1
)
Validation Errors:
Array
(
)
Debug Data
Email info
Conditional Email cancelled: SendEmail was not 1
I should add that I do have custom code actions running fine in the On Load event, and custom code boxes within the form itself.
Hi rjeffl,
There's an extra ) in this line
Bob
There's an extra ) in this line
($form->data['VCMPrevApprove'] != 1) ) {That would break it.Bob
I can't believe that I did not see that... sigh.
Works like a champ now.
Php was quietly hiding the syntax error instead of blowing up like the old days.
Thanks Bob.
I definitely need to buy you a beer!🙂
Works like a champ now.
Php was quietly hiding the syntax error instead of blowing up like the old days.
Thanks Bob.
I definitely need to buy you a beer!🙂
Hi rjeffl,
If it's a development site then you can set site Error Reporting to Maximum to get more errors to show up - but it can make a mess of some pages.
I found it by copying the code to a .php file in Sublime Text 2 where I have a PHP validator plug-in that marks syntax errors like this :-)
Bob
If it's a development site then you can set site Error Reporting to Maximum to get more errors to show up - but it can make a mess of some pages.
I found it by copying the code to a .php file in Sublime Text 2 where I have a PHP validator plug-in that marks syntax errors like this :-)
Bob
This topic is locked and no more replies can be posted.
