Form Email Plugin on specific item data in repeating group

chris.paschen

Chris Paschen
Sounds complicated, but I just need to send an email IF one field in a record (or multiple records) in a repeating group on the form has a certain value.

Is there some syntax that I can use for the Condition of the form email plugin that will allow it to only be sent when there is one of the repeating group that has a field that matches a certain value?
 
Placeholders don't lend themselves to that, so you'll have to access $formModel->formData[] directly. Elements in repeat groups will be arrays, so for a simple field being set to 1 only once in a repeat...

Code:
$myCount = 0;
foreach ($formModel->formData['your_repeat___your_element'] as $myElement) {
   if ($myElement == '1') {
      $myCount++;
  }
}

return $myCount == 1;

If the element is something like a dropdown, radio or checkbox, the value itself will be an array. So a single select dropdown would be $myElement[0].

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top