multiple fields displayed in Email Subject Line?

Post any questions you may have here

multiple fields displayed in Email Subject Line?

Postby symbic on Tue Jun 17, 2008 4:08 am

Hello,
I am new to Chronoforms but so far have had good success setting up a form in J1.5 capturing some basic data such as:
Name
Email Address
Selection Option
Date

(and also seem to be successful using validation)

I would like to include BOTH values Selected Option and Date in the Subject Line of the email message that is consequently emailed.

How do I do this?

Many thanks
symbic
symbic
Fresh Boarder
 
Posts: 5
Joined: Tue Jun 17, 2008 3:58 am

Re:multiple fields displayed in Email Subject Line?

Postby GreyHead on Tue Jun 17, 2008 11:14 am

Hi symbic,

Try this code in the 'Onsubmit before' box
Code: Select all
<?php
$rows[0]->emailsubject = "Some text".$_POST['first_fieldname']." "$_POST['second_fieldname']." some more text";
?>
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3461
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multiple fields displayed in Email Subject Line

Postby samhnky on Tue Jun 17, 2008 7:43 pm

GreyHead,

The code you supplied in your previous post looks like it is exactly what I need, however I can't seem to get it working. Is this something that you have used with Chronoforms, and if so is there anything else I need to do to get it working... i.e. placing a variable in the special fields subject field...

Thank you for your help,
Sam
samhnky
Fresh Boarder
 
Posts: 1
Joined: Tue Jun 17, 2008 7:37 pm

Re:multiple fields displayed in Email Subject Line

Postby jcksnps4 on Tue Jun 17, 2008 7:44 pm

Is there anyway to debug this? I've tried entering my values that are being posted, but my emails are sending with blank subjects... :(
jcksnps4
Fresh Boarder
 
Posts: 4
Joined: Tue Jun 17, 2008 4:18 pm

Re:multiple fields displayed in Email Subject Line

Postby GreyHead on Tue Jun 17, 2008 8:43 pm

Hi jcksnps4,

Turn debug on and you'll see the values that are being returned by the form.

Add one more line to the code:
Code: Select all
<?php
$rows[0]->emailsubject =
  "Some text".$_POST['first_fieldname']."
  ".$_POST['second_fieldname']." some more text";
if ($debug) {
  echo "subject; ";print_r($rows[0]->emailsubject);echo "<br />";
}
?>
This should print out the value of the subject as long as debug is turned on.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3461
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multiple fields displayed in Email Subject Line

Postby symbic on Wed Jun 18, 2008 1:05 am

Hi GreyHead,
I've tried the code you have suggested but can't seem to get it to work correctly.

The email is sent and shows ONE of the fields in the subject line but I also end up seeing a Parse error on the resulting thankyou page
Parse error: syntax error, unexpected T_VARIABLE in
/home/account/public_html/subdomain/components
/com_chronocontact/chronocontact.php(425)
: eval()'d code on line 2
E-mail: 'Yes' custom
Email sent




(If the Subject Field under the Special Fields tab is left blank then it seems to default to the Email Subject shown under the General Tab, regardless of using the code above)

Thanks
Denise
symbic
Fresh Boarder
 
Posts: 5
Joined: Tue Jun 17, 2008 3:58 am

Re:multiple fields displayed in Email Subject Line

Postby GreyHead on Wed Jun 18, 2008 4:59 am

Hi Denise,

Sorry there was a dot '.' missing before the second $_POST - I've put it back in my pevious post.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3461
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multiple fields displayed in Email Subject Line

Postby symbic on Wed Jun 18, 2008 6:05 am

Hi greyHead,

hmmm... still getting a Parse error:

Parse error: syntax error, unexpected ':' in
/home/domain/public_html/subdomain/components/
com_chronocontact/chronocontact.php(425)
: eval()'d code on line 4
E-mail: 'Yes' custom
Email sent
E-mail message


and it shows default Email Subject

?? again if the Subject Field under the Special Fields tab is left blank then it seems to default to the Email Subject shown under the General Tab, regardless of using the code suggested.

Any further ideas??

many thanks
symbic
Fresh Boarder
 
Posts: 5
Joined: Tue Jun 17, 2008 3:58 am

Re:multiple fields displayed in Email Subject Line

Postby GreyHead on Wed Jun 18, 2008 6:48 am

Hi symbic,

Not my day, there was a second typo in the next line a : instead of a ; - also fixed now.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3461
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multiple fields displayed in Email Subject Line

Postby symbic on Wed Jun 18, 2008 7:23 am

Yea! Thanks very much!:cheer:

All working nicely now with both fields displayed in subject line along with set text

(Note I left Subject Field blank under the Special Fields tab)

Chronoforms has ended up providing very nice solution for what i needed.

thanks again
Denise
symbic
Fresh Boarder
 
Posts: 5
Joined: Tue Jun 17, 2008 3:58 am

Re:multiple fields displayed in Email Subject Line

Postby jcksnps4 on Wed Jun 18, 2008 11:47 am

Great! Thanks!
jcksnps4
Fresh Boarder
 
Posts: 4
Joined: Tue Jun 17, 2008 4:18 pm

Re:multiple fields displayed in Email Subject Line?

Postby tonimarie on Fri Jul 04, 2008 6:25 pm

I was actually able to use this help to put five fields plus additional text in my subject line (a name and a date even though they were broken up into individual parts).

Thank you so much for this fix!
tonimarie
Fresh Boarder
 
Posts: 2
Joined: Mon Apr 16, 2007 10:00 pm


Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: Google [Bot], MSNbot Media, Yahoo [Bot] and 2 guests