I have an event that looks like this
{view:loadCSS}
{fn:loadFunctions}
<h1>In check Split Member and Partner Record for Member id {data:user_id}</h1>
{fn:validateEmail}
.
I want to add something like
{view:loadCSS}
{fn:loadFunctions}
<h1>In check Split Member and Partner Record for Member id {data:user_id}</h1>
{fn:validateEmail}
<?php
if(return value from validate email){
?>
{connection/event:ManageMemberPartners/index}
<?php
} else {
?>
{connection/event:ManageMemberPartners/getNewEmail}
<?php}
?>
That is, based on that return value, load an index page if it is true else reload the email entry form.
How do I do that? As I read the notes in the function definition page
PHP code with OUT tags, returned value will be set as var
but I can't see that in the debug output.Regards
Nick
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Event switcher
P.S: I'm just an automated service😉
Name switchCheckGetNewEmail
Data provider {var:validateEmail}
Values setup
true:{success:EMail Changed OK.}
false:{error:Problem! EMail Not Changed.}
and then this in the event checkNewEmail
{view:loadCSS}
{fn:loadFunctions}
<h1>In check Split Member and Partner Record for Member id {data:user_id}</h1>
{fn:validateEmail}
{fn:switchCheckGetNewEmail}
That function validateEmail references a PHP function
validateNewEmail($this->data);
which contains
function validateNewEmail($thisData) {
if ($thisData['nmNewEmailAddress'] != $thisData['nmRepeatEmailAddress']) {
$aMessage = 'The new email addresses are not the same.';
writeSystemMessageV5($aMessage, 'WARNING');
$returnValue = FALSE;
} else {
$returnValue = TRUE;
}
return $returnValue;
}
As I understand it, that PHP function call should return a data value validateNewEmail that I planned to use in that switch function. The problem is that it never returns true,
I must have missed something. Any suggestions? I suspect it is the same sort of problem as in this first post and that related to data not being passed between events.
Regards Nick
What is the code you have in the "validateEmail" function code box exactly ? Please use the function body code directly, do not define a "function xyz(){", just write a code to do the check and return whatever value.
Best regards,
Max
Not sure that I understand your question.
What is the code you have in the "validateEmail" function code box exactly ?
I think you mean
[attachment=58853_20170612201735_cc00-png.png]
Are you suggesting that I need to not use that function call but use the code itself so:[attachment=58853_20170612202818_cc01-png.png][/attachment]
Regards
Nick
Exactly, and please remove the php function call in the new code block too, unless the function has been defined before in another PHP block which was already run.
Best regards,
Max
Nick
I did not say that, but that is the way which is guaranteed to work and easier to test, I think that you only needed a "return" before the function call in your first version, does it work after the change made ?
Best regards,
Max
