So I started out by working with the code examples from
http://chronoengine.com/forums.html?cont=posts&f=2&t=14894
It seems to be working, with no errors after I attempted to edit it, but I still get no email. I created 2 email templates, and turned both of them off (disabled).
My FORM code:
And here is the PHP code im using. Its pasted into the onSubmit - After sending email box:
Any help straightening out my mess would be helpful. Thanks!
http://chronoengine.com/forums.html?cont=posts&f=2&t=14894
It seems to be working, with no errors after I attempted to edit it, but I still get no email. I created 2 email templates, and turned both of them off (disabled).
My FORM code:
<td><p>
<label>
<input type="radio" name="answer[]" value="answer1" id="answer1" onChange="ApproveStat(this);">
Approved</label>
<br>
<label>
<input type="radio" name="answer[]" value="answer2" id="answer2" onChange="ApproveStat(this);">
Denied</label>
</p></td>
And here is the PHP code im using. Its pasted into the onSubmit - After sending email box:
<?php
$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);
$answer_array = array (
'answer1' => 1,
'answer2' => 2
);
$answer = JRequest::getVar( 'answer', '', 'post', 'array');
foreach ( $answer as $v ) {
$v = $answer_array[$v];
$MyFormEmails->setEmailData($v, 'enabled', '1');
}
?>
Any help straightening out my mess would be helpful. Thanks!
Hi libraguy78,
Radio button groups don't need Array names as they only ever return a single value. You should be able to do this by checking for answer1 or answer2 and setting the email accordingly.
Bob
Radio button groups don't need Array names as they only ever return a single value. You should be able to do this by checking for answer1 or answer2 and setting the email accordingly.
. . .
$answer_array = array (
'answer1' => 1,
'answer2' => 2
);
$answer = JRequest::getVar( 'answer', '', 'post', 'array');
if ( $answer ) {
$v = $answer_array[$v];
$MyFormEmails->setEmailData($v, 'enabled', '1');
}
?>
Bob
This topic is locked and no more replies can be posted.