Forums

How to get thank you message to display in content area?

classic 06 Aug, 2010
Hi Guys,
I have chronoforms setup with the auth.net plugin and functioning nicely. I have placed the following PHP code to run after "On Submit code - after sending email":

<?php
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
$MyPlugins->runPlugin('after_email', array('ONSUBMIT', 'ONLOADONSUBMIT'), 'cf_Authorize_dotnet');
if($MyPlugins->cf_Authorize_dotnet['response_code'] == 'Approved'){
    echo  "Thank you for your purchase. You will be receiving a confirmation email shortly";
    $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
    $MyFormEmails->setEmailData(1, 'enabled', '1');
    $MyFormEmails->sendEmails($MyForm, $MyFormEmails->emails);
  }else{
    $MyForm->addErrorMsg( 'An error occured with the Credit Card Processing:<br />'.$MyPlugins->cf_Authorize_dotnet['response_code'].': '.$MyPlugins->cf_Authorize_dotnet['response_reason_text'] );
    $MyForm->haltFunction["autogenerated_after_email"] = true;
  }
?>


The code seems to work just fine, but it displays my messages in the module position above the form and instead I would like it to display in the main content area. How do I go about doing this?
GreyHead 07 Aug, 2010
Hi classic ,

I'm not sure, looking at the code I'd expect the 'echo'd lines to show up in the main content area?

Bob
classic 10 Aug, 2010
Will I need to separate them from the code? I tried putting the whole code chunk into the article and I get a PHP error relating to a variable not being defined. What would the syntax look like in the article vs. what remains in the "On Submit code - after sending email"?
classic 11 Aug, 2010
For those who may need this in the future, here is how we resolved the issue and performed what we were looking for:

<?php
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
$MyPlugins->runPlugin('after_email', array('ONSUBMIT', 'ONLOADONSUBMIT'), 'cf_Authorize_dotnet');
if($MyPlugins->cf_Authorize_dotnet['response_code'] == 'Approved'){
    $mainframe->redirect('PLACE YOUR APPROVED URL HERE');
  }else{
    $mainframe->redirect('PLACE YOUR DECLINED URL HERE');
  }
?>


Just place the URLS pointing to the articles you want in the two places above depending on whether the credit card transaction was required or it was declined. Thanks to Max for pointing us in the right direction.

Support for this product is outstanding!
This topic is locked and no more replies can be posted.