Forums

Hide Notice Message

elehost 20 Aug, 2009
Hello,

I am using the 3.1 RC5.5 and have a quick question on a notice error message.

I have 5 e-mail messages possibly being sent through one form. Only the first one is required and I have a lot of custom PHP code handling multi-record database submits for each record that manages the submission validation, etc...

I don't want to turn off validation.

Right now when the user does not fill out the other 4 non required e-mail addresses the notice message is shown because it seems to attempt to send the other four.

* You must provide at least one recipient e-mail address.
* You must provide at least one recipient e-mail address.
* You must provide at least one recipient e-mail address.
* You must provide at least one recipient e-mail address.

Can anyone tell me how I can set it in the code to hide this notice message from being displayed?

Thanks in advance.

Paul
GreyHead 21 Aug, 2009
Hi Paul,

You will need to add PHP to disable the Email Setups that aren't being sent. I don't remember the code off the top of my head but Max posted it here about ten days ago I think.

Bob
elehost 21 Aug, 2009
Hi Bob,

Thanks for your reply.

I found the code you were mentioning in an older post. Thanks for the heads up!

I modified it in part so that the form name does not have to be hard-coded in the php code in case it is renamed and this part is missed.

I post it here in case it helps anyone.


$formname = JRequest::getVar('chronoformname');

if ( !$formname ) {
   $params =& $mainframe->getPageParameters('com_chronocontact');
   $formname = $params->get('formname');
}

$MyForm =& CFChronoForm::getInstance("$formname");
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);

$MyFormEmails->setEmailData(1, 'enabled', '0');//disable email 1
$MyFormEmails->setEmailData(2, 'enabled', '1');//enable email 2



Thanks,

Paul
GreyHead 21 Aug, 2009
Hi Paul,

Nice, thank you.

Bob
This topic is locked and no more replies can be posted.