Email Plugin - Form

Status
Not open for further replies.

stevelis

Member
Before an email is sent, two different criteria need to be achieved.
In the Option Tab, can I have a Condition; return '{calendar___National_raw}' == 0; and then also have another field selected from the form in the Email Sent Field box.
Or, can two conditions be combined, and how is that expressed in the Condition box
tried; return '{calendar___National_raw}' == 0; AND '{calendar___noemail_raw}' == 1;
Thanks
Steve
 
Thanks Hugh
I tried with the && but as you can see from above, it was never going to work without the ' ' for '0' and '1'
Steve
 
Well, it should work without the quotes, and will (kinda) work with AND instead of &&. Your biggest problem was with the ; after the first test.

More information that you want, so you can safely ignore the rest, but for anyone of insatiable curiosity reading this ...

When using ==, then a string '1' == numeric 1. The double equals doesn't care about data type. But using ===, then '1' does not === 1, because they are different type (string vs int). You are using ==, so it doesn't matter if you quote the number. I just added it out of habit.

And with AND vs &&, they kinda work the same, except that AND has a much lower operator precedence than &&, so although it would work in your situation, using AND can trip you up. So don't use it unless you actually really know that you need to instead of &&.

For instance ...

Code:
$this = true;
$that = false;

$truthiness = $this && $that;

... will set $truthiness to false, because the combination of $this && $that are not true - one of them is false. And the && has a higher precedence than the =. So that comparison is run, and the result of the comparison it assigned to truthiness. It's effectively ...

Code:
$truthiness = ($this && $that)

... where the bit in parens is run first.

But ...

[code]
$truthiness = $this AND $that;

... will set $truthiness to true. Because the = has a higher precedence than AND, so the code is effectively ...

Code:
($truthiness = $this) AND $that

... so $this is assigned first, then the result is compared.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top