Hi,
can someone tell me if it is possible to use 2 form fields into a Dynamic Subject?
I've tried entering both fieldnames with all kinds of characters like "," "&" "+"
thanks in advance
jan
can someone tell me if it is possible to use 2 form fields into a Dynamic Subject?
I've tried entering both fieldnames with all kinds of characters like "," "&" "+"
thanks in advance
jan
In on submit BEFORE sending email a code
Rename in the DYNAMIC SUBJECT fields to subject and subject_1
This is an example I'm using, pretty sure this would guide you
Rename in the DYNAMIC SUBJECT fields to subject and subject_1
This is an example I'm using, pretty sure this would guide you
<?php
$Wedstrijddatum = JRequest::getString('Wedstrijddatum', date('Y-m-d'), 'post');
JRequest::setVar('subject', 'Nieuwe inschrijving CK P&P 2010 dd '.$Wedstrijddatum);
?>
<?php
$Wedstrijddatum = JRequest::getString('Wedstrijddatum', date('Y-m-d'), 'post');
JRequest::setVar('subject_1', 'Uw inschrijving CK P&P 2010 dd '.$Wedstrijddatum);
?>
Hi Spabo,
thanks, your example works !
Is there a way to use fields from my form? for example I have two field "CompName" & "application" which I want to get into the subject.
thanks in advance,
Jan
thanks, your example works !
Is there a way to use fields from my form? for example I have two field "CompName" & "application" which I want to get into the subject.
thanks in advance,
Jan
yeahhh... found it...
by entering a string "leeg" with default value the code for a space, the subject becomes readable
<?php
$Sub1 = JRequest::getString('radio0', '', 'post');
$Sub2 = JRequest::getString('leeg', ' ', 'post');
$Sub3 = JRequest::getString('CompName', '', 'post');
$Sub4 = JRequest::getString('application', '', 'post');
JRequest::setVar('subject', 'eComNL ' .$Sub1 .$Sub2 .$Sub3);
?>
by entering a string "leeg" with default value the code for a space, the subject becomes readable
<?php
$Sub1 = JRequest::getString('radio0', '', 'post');
$Sub2 = JRequest::getString('leeg', ' ', 'post');
$Sub3 = JRequest::getString('CompName', '', 'post');
$Sub4 = JRequest::getString('application', '', 'post');
JRequest::setVar('subject', 'eComNL ' .$Sub1 .$Sub2 .$Sub3);
?>
Hi jan35utr,
You can just add the space in this line
Bob
You can just add the space in this line
JRequest::setVar('subject', 'eComNL '.$Sub1.' '.$Sub3);
Bob
Humph... I'm close. I'm trying to create a dynamic subject from 2 fields and text and add an attachment. The attachment is working, but I'm not having much luck with the subject.
I'm using a Dynamic Subject field with the field firstname in there as a palceholder.
Here's my code for the OnSubmit code - before email:
Any ideas? It'd be really cool if I could have both a dynamically created subject and the attachment.
Thanks!
I'm using a Dynamic Subject field with the field firstname in there as a palceholder.
Here's my code for the OnSubmit code - before email:
<?php
$fname = JRequest::getString('firstname', '', 'post');
$lname = JRequest::getString('lastname','','post');
JRequest::setVar('subject', 'A-CSP Wkshop Enrollment - '.$fname.' '.$lname);
?>
<?php
$MyForm =& CFChronoForm::getInstance('ASP_CSP_workshop_2010_07'); //Replace with Your Form name
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments = array(JPATH_SITE.DS.'images'.DS.'files'.DS.'email_files'.DS.'ASP-CSP_workshop_payment_rev008.pdf');
?>
Any ideas? It'd be really cool if I could have both a dynamically created subject and the attachment.
Thanks!
Hi eglescout ,
Bob
I'm using a Dynamic Subject field with the field firstname in there as a palceholder.
Use subject instead as that's the new variable name you've created in the code snippet.Bob
Okay, I changed from Dynamic Subject to Subject and left it blank. Still no go.
I forgot to mention that I have two email messages going out. How do I distinguish which one I'm setting? In my case, it's the second one I'm trying to change. Does subject become subject_1? Thanks!
I forgot to mention that I have two email messages going out. How do I distinguish which one I'm setting? In my case, it's the second one I'm trying to change. Does subject become subject_1? Thanks!
Hi eglescout,
Oh no. . . keep the Dynamic Subject but put subject into the box.
Bob
Oh no. . . keep the Dynamic Subject but put subject into the box.
Bob
Now I understand what needs to happen. (I misunderstood what others were saying.) I hope this clears things up for others.
The purpose of the code is to create a variable with the information that I want to stick in to the subject of an email. That variable is fed into a Dynamic Subject field. Then the system will grab that info that was made in the code section and stuff it into the subject line of the email. Phew! I get it.
Here it is step-by-step:
1. Decide on a variable name that makes sense to you. I'm using subject_1.
2. On the Setup Emails tab, use a Dynamic Subject field in the email.
3. Enter your variable name (subject_1) in the Dynamic Subject field.
4. On the Form Code tab, enter the code in the field labeled On Submit code - before sending email:. See the code below.
5. Apply or save it.
Then it should work. Thanks, Greyhead!
The purpose of the code is to create a variable with the information that I want to stick in to the subject of an email. That variable is fed into a Dynamic Subject field. Then the system will grab that info that was made in the code section and stuff it into the subject line of the email. Phew! I get it.
Here it is step-by-step:
1. Decide on a variable name that makes sense to you. I'm using subject_1.
2. On the Setup Emails tab, use a Dynamic Subject field in the email.
3. Enter your variable name (subject_1) in the Dynamic Subject field.
4. On the Form Code tab, enter the code in the field labeled On Submit code - before sending email:. See the code below.
5. Apply or save it.
Then it should work. Thanks, Greyhead!
<?php
$fname = JRequest::getString('firstname', '', 'post');
$lname = JRequest::getString('lastname','','post');
JRequest::setVar('subject_1', 'A-CSP Wkshop Enrollment - '.$fname.' '.$lname);
?>
Thanks a lot!
Call me crude, but I just do this:
Call me crude, but I just do this:
$_POST['dynamic_subject'] = "Thanks, ".$_POST['first_name']."!";
Hi drdr,
In CFv4 you can use this in a Custom Code action fefore the Email action:
Then use subject_1 in the Dynamic Subject box of the Email action.
Bob
In CFv4 you can use this in a Custom Code action fefore the Email action:
<?php
$form->data['subject_1'] = "A-CSP Wkshop Enrollment - {$form->data['firstname']}";
?>
Then use subject_1 in the Dynamic Subject box of the Email action.
Bob
This thread was just what I needed! Thanks to all.
FYI, my CF version must be a bit old. The "form->data['fieldname']" method did not want to work. But "JRequest" did!
In the "Dynamic Subject" box, entered: email_subject
Placed the following code in "OnSubmit code - before email:"
</span>
And the e-mail generated had the subject field reading:
Confirming Camp "Safe Kids: 14 Jan" registration for Jenny Tester
Greatly appreciate the fine examples and alternate methods for me to try!
Cheers,
Lindsay
FYI, my CF version must be a bit old. The "form->data['fieldname']" method did not want to work. But "JRequest" did!
In the "Dynamic Subject" box, entered: email_subject
Placed the following code in "OnSubmit code - before email:"
<?php
$camp = JRequest::getString('Camp_name', '', 'post');
$fname = JRequest::getString('C_fname', '', 'post');
$lname = JRequest::getString('C_lname', '', 'post');
JRequest::setVar('email_subject', 'Confirming Camp "'.$camp.'" registration for '.$fname.' '.$lname);
?>
</span>
And the e-mail generated had the subject field reading:
Confirming Camp "Safe Kids: 14 Jan" registration for Jenny Tester
Greatly appreciate the fine examples and alternate methods for me to try!
Cheers,
Lindsay
Hi Lindsay,
Great to hear you got it working.
FYI $form->data is used in CFv4; JRequest works with CFv3.
Bob
Great to hear you got it working.
FYI $form->data is used in CFv4; JRequest works with CFv3.
Bob
Isn't there a " missing??
Where does it belong?
And how to do it with several form data fields? like firstmane and name?
Where does it belong?
And how to do it with several form data fields? like firstmane and name?
ok, there was one missing and its, in my case:
<?php
$form->data['subject_1'] = "Size - length {$form->data['length']} - weight {$form->data['weight']}";
?>
Hi analographi ,
Sorry, there was a "; missing - I fixed my original post.
Bob
Sorry, there was a "; missing - I fixed my original post.
Bob
I am having trouble getting this working. I have followed Greyhead's instructions:
and here is my code:
note in the code above that after .mls i have added an apostrophe, is this missing from the code in greyheads original post? I have tried it both ways, and my problem is still present.
when i submit the form I get an error, the form reloads, and this code is in the email fields:
What am I doing wrong? Thanks!
The site form is here:
http://realestatemobileservices.com/clients/create-a-mobile-property-page
you will need to log in with this to access the page:
u: testplan1
p: 12345
Additionally, (a separate subject here), when the form is submitted properly it takes you to another form that allows for uploading/resizing pictures. Is there a way to have this second form (a separate script in a module) included in my ChronoForms form? Or maybe a way to tag the 2nd form subject with the same field I am using in the dynamic subject of the first form? I realize this is a separate script...but though I would ask the Grand Form Wizards at ChronoForms! 🙂
Here it is step-by-step:
1. Decide on a variable name that makes sense to you. I'm using subject_propsub.
2. On the Setup Emails tab, use a Dynamic Subject field in the email.
3. Enter your variable name (subject_propsub) in the Dynamic Subject field.
4. On the Form Code tab, enter the code in the field labeled On Submit code - before sending email:. See the code below.
5. Apply or save it.
and here is my code:
<?php
$fname = JRequest::getString('full_name', '', 'post');
$mls = JRequest::getString('mls','','post');
JRequest::setVar('subject_propsub', 'P-Submit - '.$fname.' '.$mls');
?>
note in the code above that after .mls i have added an apostrophe, is this missing from the code in greyheads original post? I have tried it both ways, and my problem is still present.
when i submit the form I get an error, the form reloads, and this code is in the email fields:
<script language='JavaScript' type='text/javascript'> <!-- var prefix = 'mailto:'; var suffix = ''; var attribs = ''; var path = 'hr' + 'ef' + '='; var addy2807 = 'test' + '@'; addy2807 = addy2807 + 'test' + '.' + 'com'; document.write( '<a ' + path + '\'' + prefix + addy2807 + suffix + '\'' + attribs + '>' ); document.write( addy2807 ); document.write( '<\/a>' ); //--> </script><script language='JavaScript' type='text/javascript'> <!-- document.write( '<span style=\'display: none;\'>' ); //--> </script>This e-mail address is being protected from spambots. You need JavaScript enabled to view it <script language='JavaScript' type='text/javascript'> <!-- document.write( '</' ); document.write( 'span>' ); //--> </script>
What am I doing wrong? Thanks!
The site form is here:
http://realestatemobileservices.com/clients/create-a-mobile-property-page
you will need to log in with this to access the page:
u: testplan1
p: 12345
Additionally, (a separate subject here), when the form is submitted properly it takes you to another form that allows for uploading/resizing pictures. Is there a way to have this second form (a separate script in a module) included in my ChronoForms form? Or maybe a way to tag the 2nd form subject with the same field I am using in the dynamic subject of the first form? I realize this is a separate script...but though I would ask the Grand Form Wizards at ChronoForms! 🙂
Hi, are you on the newest version of chrono forms?
if yes this is what you need
"subject_1" is what you put into your Dynamic subject field. "name" and "surname" are the names of textfields of your form.
You can do that as many times and for whatever you wish. You can simply create new "variables" in my case "subject_1" and make them show what ever you want. be it plain text or the content of several form fields.
In case anybody is interested. here is my code which checks the value of some fields, checks the file ending of a link, checks the beginning of a link and according to that sets subject, sender, from, etc. etc. to specific values. it's a conditional sending of an email with multiple values in several dynamic fields.
If the sender does not send us the link as we want it and doesn't answer the trick questions right he will get the email back to himself and is displayed a message saying blabla. If he does as we wish, we get the message.
if yes this is what you need
<?php
$form->data['subject_1'] = "You have received a message from {$form->data['name']} {$form->data['surname']} today";
?>
"subject_1" is what you put into your Dynamic subject field. "name" and "surname" are the names of textfields of your form.
You can do that as many times and for whatever you wish. You can simply create new "variables" in my case "subject_1" and make them show what ever you want. be it plain text or the content of several form fields.
In case anybody is interested. here is my code which checks the value of some fields, checks the file ending of a link, checks the beginning of a link and according to that sets subject, sender, from, etc. etc. to specific values. it's a conditional sending of an email with multiple values in several dynamic fields.
<?php
$form->data['filetype'] = substr($form->data['demourl'], -3, 3);
//get the only the 3 letters of the ending of the link field
$form->data['filetype2'] = substr($form->data['demourl'], 0, 21);
//get the first 21 letters of the link field (demourl)
if( $form->data['length'] == "ok"
&& $form->data['representative'] == "yes"
&& $form->data['filetype'] == "zip"
|| $form->data['filetype'] == "mp3"
|| $form->data['filetype'] == "m4a"
|| $form->data['filetype'] == "rar"
|| $form->data['filetype'] == "oad"
&& $form->data['filetype2'] == "http://soundcloud.com" ){
//check if "representative has been checked "yes" and length "ok", check if file ending zip, mp3, m4a or rar or that the link starts with sound cloud and ends with "oad"
// set receiver to this address
$form->data['email1'] = "webreqxxxx@sxxxxx.com";
$form->data['rejected'] = "Demo Accepted";
$form->data['bccadress'] = "norepXXXX@XXXXXXX.com";
$form->data['subject_1'] = "Real Demo from {$form->data['artistname']} in the house";
$form->data['thanks'] = "Thank you for your message. Your demo has been accepted.";
$form->data['sender_1'] = "{$form->data['artistname']} - {$form->data['firstname']} {$form->data['name']}";
$form->data['email_from'] = "{$form->data['email']}";
} else {
$form->data['email1'] = "{$form->data['email']}";
$form->data['bccadress'] = "reXXXXXX@XXXXXX.com";
$form->data['rejected'] = "We are sorry. The demo that has been submitted is either too short, too long, not representative or not a direct link to either a zip or mp3 file. Therefore has been rejected. Did you use sendspace? Well, we do not accept that";
$form->data['subject_1'] = "Demo Rejected";
$form->data['thanks'] = "Thank you for your interest. However your demo is either too long, too short, not representative or not a direct link to either a zip or mp3 file. Therefore has been rejected. Please read the guidelines carefully. Did you use sendspace? Well, we do not accept that";
$form->data['sender_1'] = "Our name";
$form->data['email_from'] = "nxxxxx@xxxxxxx.com";
}
?>
If the sender does not send us the link as we want it and doesn't answer the trick questions right he will get the email back to himself and is displayed a message saying blabla. If he does as we wish, we get the message.
Hi Riceman,
The code you are using is for ChronoForms v3. See analagraphi's posts before and after yours for the CFv4 code.
The odd message is because you have the Joomla! Email Cloaking Plug-in enabled and it is trying to cloak the sample e-mail in the ChronoForms validation message. Disable the plug-in temporarily to check this is the problem. If you need the plug-in change the plug-ins order so that Email Cloaking runs before ChronoForms.
NB These are Joomla! plug-ins that you manage from Site Admin | Extensions | Plug-in Manager
Please will you put the last question into a new post (copy and paste is fine) as this is a different topic.
Bob
The code you are using is for ChronoForms v3. See analagraphi's posts before and after yours for the CFv4 code.
The odd message is because you have the Joomla! Email Cloaking Plug-in enabled and it is trying to cloak the sample e-mail in the ChronoForms validation message. Disable the plug-in temporarily to check this is the problem. If you need the plug-in change the plug-ins order so that Email Cloaking runs before ChronoForms.
NB These are Joomla! plug-ins that you manage from Site Admin | Extensions | Plug-in Manager
Please will you put the last question into a new post (copy and paste is fine) as this is a different topic.
Bob
Alhoa and Mahalo for the help,
I am using CFv3, just for the record.
So, I turned the Cloaking Plugin off, and I am still getting an error. Although without the code inserted into the email fields. The problem is the Error doesn't tell me what the issue is.
Also I tried it with and without the additional apostrophe in the other bit of code I referred to above.
[attachment=0]Screen Shot 2012-01-28 at 9.23.15 AM.png[/attachment]
I am using CFv3, just for the record.
So, I turned the Cloaking Plugin off, and I am still getting an error. Although without the code inserted into the email fields. The problem is the Error doesn't tell me what the issue is.
Also I tried it with and without the additional apostrophe in the other bit of code I referred to above.
[attachment=0]Screen Shot 2012-01-28 at 9.23.15 AM.png[/attachment]
Hi Riceman ,
Is this the latest ChronoForms version 3.2?
If so there's a bug in the File upload code. Please see this post.
Bob
Is this the latest ChronoForms version 3.2?
If so there's a bug in the File upload code. Please see this post.
Bob
Yup, 3.2. It was working fine before I started fiddling with the Dynamic Subject.
Well, I do have the latest version installed(I think), but replacing the chronoformsuploading.php did the trick!
Thanks
Thanks
This topic is locked and no more replies can be posted.