Forums

SOLVED: Simple question about CF on J 1.0, wrt BCC special f

Els 17 Feb, 2009
Hi,

I've got a form, where I want more than one field value to be in the BCC special field.
All works nicely, as long as I have only one fieldname mentioned in that BCC field. How do I add a second one? I've tried comma separated, space separated, and even semi-colon separated. As soon as I add a second fieldname, the whole email doesn't get sent. Is this a bug, or something I'm just doing wrong?

--
Els
GreyHead 17 Feb, 2009
Hi Els,

I don't think that you can use more than one fieldname in a Dynamic BCC box.

Put a hidden field in your form with an empty value; enter it's name into the Dynamic BCC box; then in the OnSubmit Before box put some PHP to get the two emails and link them together into a sinlge value and put that into the hidden field variable.

Bob
Els 17 Feb, 2009
Hi Bob,

Thanks for the idea :-)
The script is picking up the value I give in the OnSubmit Before box (tested with a straight email addres), but somehow it doesn't work with two values together. I tried a comma between the two, and also tried a semicolon, but I'm guessing it will need to be something else. Any idea what?

This is the code I tried (comma version, but also tried with semi-colon instead of comma):

<?php
     $_POST['friendemails'] = $_POST['friendemail1'].",".$_POST['friendemail2'];
?>


--
Els
Max_admin 18 Feb, 2009
Hi Els,

the concatenation output should be added to the direct BCC field which name is not friendsname

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Els 18 Feb, 2009
Hi Max,

I'm not sure what you mean by "the direct BCC field".
In Chronoforms (Joomla 1.0 version) I have two BCC fields. One in the first general tab, which will only take actual email addresses. Comma separated works there. The other BCC field, under the special fields tab, only takes fieldnames.

With the piece of script mentioned above, I can add the "friendemails" fieldname to that latter BCC field.

'friendemails' is a hidden field I added to the form.
'friendemail1' and 'friendemail2' are non-hidden fields in the form.

If I write the script as
<?php
     $_POST['friendemails'] = $_POST['friendemail1'];
?>

And I write "friendemails" in the special fields tab's BCC field, it works.
What I need however, is not one single address in that BCC field, but a couple of them. Hence Bob's idea of adding them together as per the script I mentioned. It's just that comma separated or semi-colon separated doesn't work.

Am I missing something maybe? What I need in the end, is to send the confirmation email, using the email template, with in the BCC field some addresses which are not known by me, but which are entered in the form.
Els 18 Feb, 2009
When I switch on the debugging, I see that the multiple addresses are correctly added.
For the purpose of visibility, I've used the 'to' field instead of 'bcc', but it doesn't make a difference in the result.
The debug code shows the _POST: Array ( ) with all the fieldnames and their values, and the email shows a nicely comma separated list of email addresses in the to: field. Yet, it shows as Email not sent.

I've looked in chronocontact.php, but I can't discover what it is that makes the email not being sent.
If I fill out the standard 'to' field with "info@example.com,post@example.com" the email gets sent.
If I put two field values in the special 'to' field, the email does not get sent. Both emails look exactly the same though, have the exact same content in the 'to' field.

One thing that perhaps could have something to do with it, is this part in chronocontact.php:
        /**
         * Substitute field values if they are set
         */
	    if ( trim($paramsvalues->subjectfield) != "" ) {
	        $subject       = $_POST[$paramsvalues->subjectfield];
	    }
	    if ( trim($paramsvalues->fromemailfield) != "" ) {
	        $from          = $_POST[$paramsvalues->fromemailfield];
	    }
	    if ( trim($paramsvalues->fromnamefield) != "" ) {
	        $fromname      = $_POST[$paramsvalues->fromnamefield];
	    }
	    if ( trim($paramsvalues->emailfield) != "" ) {
	        $recipient[]   = $_POST[$paramsvalues->emailfield];
	    }
		if ( trim($paramsvalues->ccfield) != "" ) {
	        $ccemails[]   = $_POST[$paramsvalues->ccfield];
	    }
		if ( trim($paramsvalues->bccfield) != "" ) {
	        $bccemails[]   = $_POST[$paramsvalues->bccfield];
	    }


In reality, the values in the special fields are not replacing the standard ones, but are added to it.
If I fill out [email]info@example.com[/email] in the standard 'to' field (I have to add an address if email is set to 'yes'), and in the special 'to' field I set a single form fieldname, the email gets sent to both addresses. The code above, as well as the information in the component's interface, suggests it should be replaced, not added.

Any ideas?
Max_admin 18 Feb, 2009
I mean try to make it like this:

<?php
     $rows[0]->bccemails = $_POST['friendemail1'].",".$_POST['friendemail2'];
?>


where bccemails is the name of the BCC field in the general tab!

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Els 19 Feb, 2009
Thanks Max,

I've tried that, but although the email is now sent (to the address in the 'to' field), the BCC ones aren't.
I looked in the source of the general tab's form to find the name of the bcc field and found this:
<input name="params[bccemail]" id="bcc_email" class="inputbox" size="50" maxlength="500" value="" type="text">

So, the name being "params[bccemail]", I tried this:
$rows[0]->params[bccemail] = $_POST['friendemail1'].",".$_POST['friendemail2'];

Since that didn't work, I also tried:
$rows[0]->bccemail = $_POST['friendemail1'].",".$_POST['friendemail2'];

No result still, so I even tried to use the ID instead of the name:
$rows[0]->bcc_email = $_POST['friendemail1'].",".$_POST['friendemail2'];


None of these work. They don't prevent the email from being sent, yet they don't send to the BCC addresses.
Am I overlooking anything obvious?
Max_admin 19 Feb, 2009
Hi Els,

Sorry for missing this, long time since the J1.0 version, use this:
$paramsvalues->bccemail


Cheers
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Els 19 Feb, 2009
Thanks Max,

that works! :-)

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