Hi,
i have created a "General Enquiries" contact form which is working OK, except that the Dynamic From and Dynamic Subject fields i have created don't work.
Here is a screenshot from the Setup Emails screen - all fields are Enabled, and the dynamic fieldnames definitely match the ones in the form:

Here is the debug from a test:
So as you can see, the message body is reporting correctly the fields {SenderEmail} and {Subject} - but they're not appearing in the actual Subject body or the From body.
Can anyone help?
cheers
i have created a "General Enquiries" contact form which is working OK, except that the Dynamic From and Dynamic Subject fields i have created don't work.
Here is a screenshot from the Setup Emails screen - all fields are Enabled, and the dynamic fieldnames definitely match the ones in the form:
Here is the debug from a test:
From: []
To: [email]postmaster@leedsnetwork.org[/email]
CC:
BCC:
Subject:
Sender's name: Dom M
Sender's email: [email]test@yahoo.com[/email]
Message subject: Lorem Ipsum
Message:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nec leo purus, eu venenatis est. .
Submitted by 88.107.196.9
So as you can see, the message body is reporting correctly the fields {SenderEmail} and {Subject} - but they're not appearing in the actual Subject body or the From body.
Can anyone help?
cheers
Hi buckwheatpie,
No quotes, no brackets. And Dynamic Subject only takes a field_name - you'll need to construct the compound string in the OnSubmit Before Box.
Bob
No quotes, no brackets. And Dynamic Subject only takes a field_name - you'll need to construct the compound string in the OnSubmit Before Box.
Bob
Great! I removed all those brackets, and the "Webpost:" text, and it worked fine.
Thanks
Thanks
OK - so now i'm trying to make it so that if the "send a copy to your own email address?" box is checked, the sender's email is included in the "To" field.
So i figure i need to create a new field consisting of
The bit i don't know how to do is to set a field value in the OnSubmit script - incredibly simple, i'm sure, but i don't know it!
The code i tried is:
And i put $to in the "Dynamic to" box in the Setup Emails tab - i wasn't expecting it to work, and it didn't... any pointers?
cheers
So i figure i need to create a new field consisting of
SenderEmail.","PostmasterEmail
and this field is created in the OnSubmit code.The bit i don't know how to do is to set a field value in the OnSubmit script - incredibly simple, i'm sure, but i don't know it!
The code i tried is:
<?php
if ($MyRow->SendSelf="Yes")
$to=$MyRow->SenderEmail.",postmaster@leedsnetwork.org";
else
$to="postmaster@leedsnetwork.org";
?>
And i put $to in the "Dynamic to" box in the Setup Emails tab - i wasn't expecting it to work, and it didn't... any pointers?
cheers
Hi buckwheatpie,
The Dynamic CC field is the easy way to do this with a little logic to set a dummy field value if the box is checked.
Bob
The Dynamic CC field is the easy way to do this with a little logic to set a dummy field value if the box is checked.
Bob
Sure, i see what you mean - so i've set the Dynamic CC to a field called "SenderCopyEmail",
And in the form code i've created a hidden field with:
and in the OnSubmit code i've put:
It's still not quite working - i would guess i need a special function in the SenderCopyEmail=$Myrow... bit but i don't know what it is! any pointers?
much cheers
And in the form code i've created a hidden field with:
<input type="hidden" name="SenderCopyEmail" value="">
and in the OnSubmit code i've put:
<?php
if ($MyRow->SendSelf="Yes")
SenderCopyEmail=$MyRow->SenderEmail
else
SenderCopyEmail=""
?>
It's still not quite working - i would guess i need a special function in the SenderCopyEmail=$Myrow... bit but i don't know what it is! any pointers?
much cheers
Hi BuckWheatPie,
Try
Bob
Try
JRequest::setVar('SenderEmail', $MyRow->SenderEmail, 'post');
Bob
Thanks Bob! Hopefully that's that sorted now.
Incidentally, i couldn't get your suggestion using $MyRow->SenderEmail to work, but it did work with JRequest::getVar as below:
Cheers once again.
Incidentally, i couldn't get your suggestion using $MyRow->SenderEmail to work, but it did work with JRequest::getVar as below:
<?php
if ($MyRow->SendSelf="Yes")
JRequest::setVar('SenderCopyEmail', JRequest::getVar('SenderEmail'), 'post');
?>
Cheers once again.
This topic is locked and no more replies can be posted.