Forums

send email only on certain condition

marklandry 16 Dec, 2011
Hi,

I'm using chronoforms V4 for an online application.
It's setup so the user can save their info and come back and submit the form later if they want to.
I'm wondering if I can have the form email the results only if they select a "completed" radio button at the end of the form? If the select the "not completed" option, it saves to the db but doesn't send the email

Thanx for your help

Mark
marklandry 16 Dec, 2011
I found one of Bob's posts that deals with this.
In custom code before emails I've got:

<?php
if ( isset($form->data['process'] && $form->data['process']=2 ) {
  $form->data['send_email'] = 1; 
} else {
  $form->data['send_email'] = 0;
}
?>

And in the email action label I've got:

send_email::1


Result is that no emails are going out...
marklandry 16 Dec, 2011
Emails not going out was a different problem - not CF related

Prob now is that emails go out either way.

Just to make sure, I added a new checkbox called "saveme"
Here's what I have in custom code before emails:

<?php
if ( isset($form->data['saveme'] && $form->data['saveme'] ) {
  $form->data['send_email'] = 1; 
} else {
  $form->data['send_email'] = 0;
}
?>

And the email action label set to send_email::1

Again, email goes out regardless of whether the saveme field is checked or not

Thanx again for your help

Mark
marklandry 16 Dec, 2011
Ah,
Just saw Bob's custom action for emails - I was pulling my hair out trying to figure out what email[GH] meant...

Works fine - looks like it's been upgraded/simplified since the post I saw. Great plugin - saved the day again!

Mark
GreyHead 16 Dec, 2011
Hi Mark,

I updated the action a couple of days ago to fix a bug with Joomla! 1.5 where emails weren't being sent. Could that be the problem here?

Bob
marklandry 16 Dec, 2011
Nope - working great for me!
Max_admin 26 Dec, 2011
Hi Mark,

I hope you managed to solve this issue, in the new V4 RC2.1 you will be able to dynamically change any action setting using the code below:


<?php
$form->set(ACTION_ID, 'enabled', 0);
?>


The code above will disable the action with action id = "ACTION_ID", this should be an integer and will be displayed under the form wizard "Events" tab.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.