Is there a way to populate the recipients email address after submission, Example: you have a list persons shown within a contact list, and after a user clicks a contact link that passes the contact persons id ref to a 'contact by email form', that does not show the recipients email address anywhere! not even in a hidden input form element. So that only when the form is submitted, will the recipients email address be populated somehow by retrieving the email address by using the id ref from database table.
Thanks in advance
Hi MyPetHamster,
Yes. Which vesion of ChronoForms are you using?
For CFv3 the answer is in FAQ #31
For CFv4 I'd need to think about it (though I think that the answer is already in the forums).
Bob
Sorry have not replied earlier, forget to click auto notification email on reply button.
Version is a couple years old, can't see version listed in joomla anywhere? but chronoforms download i have is ChronoForms_V3.1_RC5.5.zip.
Will check out FAQ #31 thanks!
So just read the FAQ 31, and from what i gather i would
1) use a hidden input element to hold the id ref passed from clicked link
<input type="hidden" name="id_ref" value="<?php $_POST['id'] />
in the form.
2) then search database table for email address where id = id_ref
"SELECT email from MYTABLE WHERE id = id_ref"
use returned value to populate $emails_2 = $db_email_addr;
and adjust below to directly read email address to send to variable
$MyFormEmails->setEmailData(1, 'to', $emails_2);
so all i need to adjust are
<?php
$emails_2 = array('em1'=>'sample1@email.com', 'em2'=>'sample2@email.com', 'em3'=>'name_3@example.com', . . .);
$MyForm =& CFChronoForm::getInstance('form_name_here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);
?>
what do i add in the required recipients email input box? within email setup in form
Hi MyPetHamster,
Which version of ChronoForms are you using? The code for CFv4 is a bit different from CFv3.
Bob
The only version ref i can find is
"Show a Chronoform, works on J1.5 and ChronoForms V3.1 RC5.2"
which is listed in chronoforms module and plugin.
Thanks Greyhead, that worked first time (more or less, after i enabled the email in the email setup form, that always catches me out)
Hello,
By any chance can you provide me with the right code as shown on FAQ#31, but for CFv4 ?
Thank you very much for your help. 🙂
Manes
Hi Manes,
I think I've answered this in another thread?
Bob