Forums

Yet another conditional email question

erc 15 Aug, 2011
I have an email action that is disabled by default. If a particular textarea is filled in, I want to enable that action/send that email.

I took a look at the Email GH action, and from what I can see, it only looks for a particular string, but what I need to check is to be sure that the field isn't blank.

The field is called technology. This is my first day with ChronoForms, but I'm assuming I would create a Custom Code action for the On Submit event that looks something like this:

$technology = [get technology field data];
if($technology !== '') {
  [enable technology email action];
}


But as you can tell, I'm not really sure to go about interacting with ChronoForms data.

If I can get some of this conditional stuff working, I'll buy a license in a heartbeat. I just spent $40 on a WordPress form building plugin which is very polished and easy to use, but not nearly as flexible as ChronoForms.
GreyHead 15 Aug, 2011
Hi erc,

There is some more conditionality that could usefully be built into ChronoForms but it is very flexible and many things can be done with a little ingenuity.

In this case a Custom Code action before the Email [GH] action should do it. In the code box add
<?php
if ( isset($form->data['technology'] && $form->data['technology'] ) {
  $form->data['send_email'] = 1; 
} else {
  $form->data['send_email'] = 0;
}
?>
Then you can use send_email::1 in the Email [GH] action box.

Bob
erc 15 Aug, 2011
Very clever! I'll give that a shot, thank you🙂
erc 15 Aug, 2011
That worked quite well, thank you for the inspiration.

Unfortunately, I'm now running into this Joomla! bug:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=26&t=21096&p=72215

Which seems to have been reported back in April and confirmed in Joomla! 1.6.1 but not resolved yet:
http://joomlacode.org/gf/project/joomla/tracker/%3Faction%3DTrackerItemBrowse&tracker_id%3D5782/?action=TrackerItemEdit&tracker_item_id=25565

Which is unfortunate. I appreciate your help, though, so beer is on the way🙂
GreyHead 16 Aug, 2011
Hi erc,

Thank you. I think that I tried the fix in the bug report and it works OK . . . not certain though.

Bob
megana 26 Jan, 2012
Hi there,

I'm trying to do this same thing, but I don't see the Email [GH] action. I'm using Chronoforms 4. What am I missing?

Thanks!
megana 26 Jan, 2012
Thanks, I had to upgrade to a newer version of Chronoforms 4 before I could see the Install Actions button. Got it now!
This topic is locked and no more replies can be posted.