Copy link to clipboard
Copied
Hi Everybody,
I am not a tech person but I'll try my best describing the situation.
When I yesterday tried to fix an error message (which always showed when not all requiered fields were filled in at our company's "Request for Quote" site), I think I messed up the whole inquiry-forwarding system. I must have deleted everything.
My company's using Macromedia Dreamwaver 8, and the guy who wrote the pages are long gone. If only I could revert the present non-functioning system how it used to be but it's too late, I already turned my comp off yesterday.
The way it should work is that the customer types in all info we need from him, then pushes the submit button, which then sends an email to us and leads the customer to our "Thank you for your inquiry" page. If some eror happens, it brings the customer to our mailto.cfm page, which now shows some error message I do not understand about the 3rd line, variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"RECIPIENT") );
Here's what I found as an old-timer back-up to our mailto.cfm page (which I altered yesterday, and that caused the whole problem), which no longer works either:
<cfscript>
variable.fieldnames = form.fieldnames;
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"RECIPIENT") );
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"SUBJECT") );
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"THANKURL") );
</cfscript>
<cfparam name="FORM.SUBJECT" default="Web Site Form">
<cfmail to="ouremail@ourdomain.com" from="inforequest@ourdomain.com" subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
<cfloop index="i" list="#variable.fieldnames#"><cfif len(evaluate("form.#i#"))><cfif uCase(right(i,6)) eq "_BREAK">#chr(13)#</cfif>#ReplaceNoCase(i,"_BREAK","")#:#RepeatString(" ", evaluate(15-len(ReplaceNoCase(i,"_BREAK",""))))# #Replace( evaluate("form.#i#"), chr(10), chr(10) & RepeatString(" ",17), "All" )# #chr(13)#</cfif></cfloop>
</cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
It seems simple, the to-field is correct, the from-field must be too, why do you still think that it's not forwarding the inquiries as emails any more? Where is this code broken?
I would welcome all suggestions, I really need your help!
Ok this is wierd, but your system does not seem to be accepting the line returns in the code. That is not normal behavior. But you can hard code them in.
Out of curisoity what type of systems are you working with?
<cfmail
to="julianna@airengineering.com"
from="#form.email#"
subject="#FORM.SUBJECT#">
#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')##chr(13)##chr(10)#
<cfloop list="#form.fieldnames#" index="field">
<cfif listFindNoCase("RECIPIENT,SUBJECT...
Copy link to clipboard
Copied
I don't even know where to start with that code... It must not be copied correctly in this forum. I don't see closing tags, quotes all kinds of syntax that would all this to be return anything but garbage.
What is the error message you are receiving?
What exactly is gone? What is be restored?
You are describing a pretty simple requirement that should not take a person very long to recreate if there is not more to the details.
A basic contact HTML Form and a CFML action page to email it somewhere is ColdFusion 101 and can be found in most basic CF turtorials and books.
Here is the section of the ColdFusion documentation that includes example code.
http://livedocs.adobe.com/coldfusion/8/htmldocs/email_04.html
Copy link to clipboard
Copied
I am soo confused too. First of all, I do not understand how could I have changed the well-functioning of the whole email sending process when I only edited the strange error message page (which is called mailto.cfm)...Until this morning I did not even had an idea what is Coldfusion.
Anyways, on our quote request page there's plenty of info to be entered and we need an email about all those, like date, name, title, company name etc, everything that was entered there for that query. I do not even know if what version of Coldfusion should I use, or at all, if I should use Coldfusion, then how should this code look like, and all in all, why cannot life be easier?:-))
After the quote request page, this comes up immediately, instead of the thank you page. The error message right now says:
| Error Occurred While Processing Request | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
Copy link to clipboard
Copied
Ok, now I have some place to start to help.
First of all you do not need to know about what version of ColdFusion to use. ColdFusion is the language, not the Integrated Development Environment. All that Code you see that looks like <cfthis...> and <cfthat> that is the CFML i.e. ColdFusion Markup Language your application was written in.
mailto.cfm is a CFML file that is processing your contact form when it is submitted. It is building the email to be sent. It is not the error message page, it is a page throwing an error.
The error it is thowing is "Invalid list index 0". It thinks the error is on line 3, CF is pretty good at getting the right line for an error, but sometimes you need to look around that line for the true cause of the error.
In your case line 3 is: "variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"RECIPIENT") );" and I think it is likely the source of the error. This line wants to delete an item from the list 'variables.fieldnames'. The item it wants to delete is whereever an item equal to 'RECIPENT' is in the 'variables.fieldnames' list. The problem is that 'RECIPENT' is not an item in the variables.fieldnames list so the ListFindNoCase() function is returning the value 0 and the ListDeleteAt() function can not delete item 0 as that is illeagal so it is throwing an error.
Why variable.fieldnames no longer has a value equal to 'RECIPENT' would depend on what changes you made to the code yesterday or today.
Copy link to clipboard
Copied
Thanks for your explanation Ian, I get the big picture now. What I might not have told you is this:
I have not modified the code myself at all, what I did is I accidentally deleted it as a whole and then I tried to find the latest back-up version possible which is around 2 years old, but supposedly was a functioning one back then. That is the one that you saw and that you described as garbage:-)))! I do not know if the one I deleted was even similar to this of course...
Even if it's messed up, I just need to make it work and I do not have any clue why is the "Recipient" input that problematic. I do not have the knowledge of just simply re-writing the mailto.cfm file...do you think it would work if I would just leave the whole first part out between the 2 "cfscript"s? I guess this is just a silly layman-question...
<cfscript>
variable.fieldnames = form.fieldnames;
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"RECIPIENT") );
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"SUBJECT") );
variable.fieldnames = ListDeleteAt(variable.fieldnames, ListFindNoCase(variable.fieldnames,"THANKURL") );
</cfscript>
Also, the "from email address" what it writes is no longer available, so I just changed it to another one on our server, but it sill does not work.. Can I just pick any email address I want btw or does it need to be a server?
Thanks if you still will hold on to me after these these many tiresome & basic questions..
Copy link to clipboard
Copied
Julianna01 wrote:
That is the one that you saw and that you described as garbage:-)))
Not that your code is necessarily garbage, I suspect it is the new forum format that is notorious for mangling code examples, making them unreadable and unrunnable garbabe.
The most basic form of the CFML mail tag is this:
<cfmail from="anEmailAddress" to="anEmailAddressORAddressList" Subject="ASubjectString">
Email Text
</cfmail>
Any of the itilic content can either be hard coded or provide from variables.
To see what form variables you are receiving from your code you can put this at the top of the mailto.cfm page.
<cfdump var="#form#"><cfabort>
This will display a table of all the form variables the CFML file received from the form submit request.
You can put any of those form variable into your <cfmail...> tag with the following from.
#form.fieldName# i.e. #form.firstName# or #form.street#
What all the <cfscript>...></cfscript> code seems to be doing is removing fields from the data received from the form data. Why the code does this or if you can live without it doing so depends on what your code does if these fields exist.
You can temporarily comment code so that it does not run by putting it between <!--- and ---> CFML comment tags. Note this will not work between an opening <cfscript> and a closing </cfscript> tag. Inside the tag you can use // characters at the beginning of each line to comment them so they do not run.
Copy link to clipboard
Copied
I did try your suggestion and the error message indeed changed to the table, pretty cool! So I see now the fieldnames.
However, it still does not post and in 40 mins or so I'll have to give up as I have to go home.
There's obviously some problem with that Recipient option which I still do not understand, how could I eliminate that? Maybe I should just try to re-write this whole thing myself from scratch? I'm sure I would mess sg up, I don't even know how to start and finish, not even talking about the "required fields", without which it should not post.
Ian, thanks so much for your help all afternoon, I really appreciate it!
Copy link to clipboard
Copied
Julianna01 wrote:
Maybe I should just try to re-write this whole thing myself from scratch?
That is what I was basically giving you the tools to do. It is pretty trivial to spit out form data into a <cfmail...> tag and have custom e-mails flying all over the internet.
Start including required fields and conditional logic and what not and that trivial task can become quite complex very quickly.
You can try debugging the code the same tools are usefull for that as well. Basically find a spot, dump out variables you are interest in looking at with <cfdump var="someVariable">. Use <cfabort> if you want to stop processing right there. Fix or modify what you find and move down the code.
Other then that we are getting into serious requirments gathering and contract coding.
Copy link to clipboard
Copied
OK I started re-writing this thing, just with the mailto tag. This is a sample of an earlier Request we have received, How do I shouw these capital lettered titles though?
Quote Request
Sent Thursday March 26, 2009 @ 3:23 PM SUBJECT: Quote Request
THANKURL: thankyou.htm
TITLE: Mr.
FIRSTNAME:
LASTNAME: Cornejo
COMPANY:
ADDRESS1:
CITY:
STATE:
Also, how do I show the original sender's email address as the email address that would show up in the email's from-section what we receive?
That's where I am at right now:
<cfmail
to="my email"
from="another email on our server, but it actually should show the sender's!"
subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
And from here on I do not know how to show:
firstname etc...
#form.firstname#
</cfmail>
Copy link to clipboard
Copied
At the most basic, just type it into the message.
<cfmail...>
FIRSTNAME: #form.firstname#
</cfmail>
As you show more and more bits of the application I am getting more glimpses of what the original code was doing. It looks like it was some type of automatic form to email message converter, just taking the name of the form field and the value of the form field and putting them into the message. Here is a much easier way to do what that clumsy script was doing earlier.
<cfmail...>
<cfloop collection="#form#" item="field">
#field#: #form[field]#
</cfloop>
</cfmail>
See if that doesn't jump you ahead a bit.
To put a form field with the senders e-mail in from parameter, just put the appropiate field there. Something like this:
<cfmail ... from="#form.email#">
Copy link to clipboard
Copied
Whoaaaa I don't know what this is but it really made this baby sing, Ian!
However, the lot of data is pouring in one line, without any breaks so it's tough to see!
Also, can we do it so that only those fields show up where the customer typed in sg? No need to see all the idle fields.
I enjoy it so much here doing this with you that I stayed longer, but in 9 mins I will really need to leave :-(.
I'm so happy though because of our great advancement, wow, this is magic:-))
Copy link to clipboard
Copied
This damn forum just ate my last reply.... I hope I remember all of it.
<cfmail...>
<cfloop collection="#form#" item="field">
<cfif len(trim(form[field])) GT 0>
#replaceNoCase(field,"_BREAK","")#: #form[field]#<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif>
</cfif>
</cfloop>
</cfmail>
len() counts the length of a string.
trim() removes any whitespace from the beginning or the end of a string.
replaceNoCase() will replace the second string with the thrid string in the first string.
uCase() will turn a string into upper case. This is probably true, but is good to be safe.
right() will return the second number of characters from the first string.
chr() returns the character by the given ascii code.
Message was edited by: Ian Skinner P.S I did forget one thing from my original message that disappeared. My day is also about done (3:30pm Pacific Timezone). I'll return Tuesday to take up wherever you get to.
Copy link to clipboard
Copied
I think I figured out the rest of the code, it is padding strings so that they are all the same length and replacing line feed characters with string padding. I presume to make the mail message look nicer to read. This should be close, but this is quite a bit of code to type without any checking. There very well may be missing parentheses or other characters.
<cfmail...>
<!--- Loop over all the fields of the form collection --->
<cfloop collection="#form#" item="field">
<!--- If the current form field contains a non-empty string --->
<cfif len(trim(form[field])) GT 0>
#replaceNoCase(field,"_BREAK","")#: <!--- output the field name without the string '_BREAK'--->
#repeatString(" ",15-len(replaceNoCase(field,"_BREAK","")))# <!--- Space pad the form field to 15 characters --->
#replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")# <!--- Replace all new line chr(10) characters with a new line and 17 spaces --->
<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif> <!--- if the field name contains the string '_BREAK' output a carriage return chr(13) character --->
</cfif>
</cfloop>
</cfmail>
Copy link to clipboard
Copied
Hi Ian,
Indeed there was sg going on with this forum as it did not let me say goodbye on Friday afternoon. Well, I could at least leave so that emails were flowing thanks to you, even if very tough to read.
Here is what the code says right now , having implemented your most recent suggestions (I almost did not change anything, as I have ZERO clue what means what):
<cfmail
to="julianna@domain.com"
from="email@domain.com"
subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
<!--- Loop over all the fields of the form collection --->
<cfloop collection="#form#" item="field">
<!--- If the current form field contains a non-empty string --->
<cfif len(trim(form[field])) GT 0>
#replaceNoCase(field,"_BREAK","")#: <!--- output the field name without the string '_BREAK'--->
#repeatString(" ",20-len(replaceNoCase(field,"_BREAK","")))# <!--- Space pad the form field to 20 characters --->
#replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")# <!--- Replace all new line chr(10) characters with a new line and 17 spaces --->
<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif> <!--- if the field name contains the string '_BREAK' output a carriage return chr(13) character --->
</cfif>
</cfloop>
</cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
I changed the middle "15" to "20", not even really knowing what it meant because an error message did not like the 15 for some reason. As you will see below, we have still some further way to go as this code now brings up the fields in a very strange order, and puts the inputs in the next row (eg. PHONE should be in the same row as when the customer types in the number, now called "12345678test")
And this is how my test inquiry was emailed to me:
Quote Request
Sent Monday May 11, 2009 @ 11:08 AM PHONE:
12345678test QUANTITY_1:
1test
PARTNUMBER_1:
TESTpart CITY:
TESTcity SUBJECT:
Quote Request COMPRESSORSERIAL_1:
TESTserial COMMENTS:
TEST Comment
DESCRIPTION_1:
TESTdesc. FIELDNAMES:
SUBJECT,THANKURL,TITLE,FIRSTNAME,LASTNAME,TITLE2,COMPANY,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTRY,PHONE,FAX,EMAIL,COMPRESSORMAKE_1_BREAK,COMPRESSORMODEL_1,COMPRESSORSERIAL_1,COMPRESSORHP_1,COMPRESSORMAKE_2_BREAK,COMPRESSORMODEL_2,COMPRESSORSERIAL_2,COMPRESSORHP_2,COMPRESSORMAKE_3_BREAK,COMPRESSORMODEL_3,COMPRESSORSERIAL_3,COMPRESSORHP_3,QUANTITY_1_BREAK,PARTNUMBER_1,DESCRIPTION_1,QUANTITY_2_BREAK,PARTNUMBER_2,DESCRIPTION_2,QUANTITY_3_BREAK,PARTNUMBER_3,DESCRIPTION_3,QUANTITY_4_BREAK,PARTNUMBER_4,DESCRIPTION_4,QUANTITY_5_BREAK,PARTNUMBER_5,DESCRIPTION_5,COMMENTS_BREAK ADDRESS1:
TESTadd FIRSTNAME:
TESTfirst STATE:
teststate TITLE2:
TESTtitle COMPRESSORMAKE_2:
TESTmake2
ZIP:
12345test THANKURL:
thankyou.htm LASTNAME:
TESTlast TITLE:
Mr. COMPRESSORMAKE_1:
TESTmake
COMPRESSORMODEL_1:
TESTmodel EMAIL:
TESTemail@test.com COMPANY:
TESTcompany
Here's how it should look like:
Quote Request
Sent Thursday April 2, 2009 @ 2:07 PM SUBJECT: Quote Request
THANKURL: thankyou.htm
TITLE: Mr.
FIRSTNAME: XXX
LASTNAME: Santana
TITLE2: General Manager
COMPANY: XXX
ADDRESS1: XXX
ADDRESS2: XXX
CITY: XXX
STATE: XX
ZIP: XX
PHONE: XXX
FAX: XXX
EMAIL: XXX
COMPRESSORMAKE_1: Atlas Copco
COMPRESSORMODEL_1: XXX
COMPRESSORSERIAL_1: XXX
QUANTITY_1: 1
PARTNUMBER_1: XXX
DESCRIPTION_1: oil cooler
Looking forward to your next ideas on how we could fix these!
Julianna
Copy link to clipboard
Copied
Starting a New reply thread as the old one was getting two narrow to read.
Julianna01 wrote:
Hi Ian,
I changed the middle "15" to "20", not even really knowing what it meant because an error message did not like the 15 for some reason.
The number, as the comment indicates is to add spaces to the beginning of form field names to make them all the same lenght. If the field name is longer then the provided lenght, then the 15-lenght would return a negative number which is illegal in for a repateString() function.
<!--- Loop over all the fields of the form collection --->
<cfloop collection="#form#" item="field">
Change this to a list loop that will loop over the form fields in the same order they are in the form.fieldnames variable. This is what the original code did. It relies on the the order of the field as provided by the browser and the web server, which apparently is the order they are in the form page. I am not sure I would rely on this order, but it is what the original coder did.
<!--- Loop over all the field in the form.fieldnames list --->
<cfloop list="#form.fieldnames#" index="field">
The the last part of the orginal code was logic to remove some field names so they did not get printed... Here is a little easier way to do that piece.
<!--- Loop over all the field in the form.fieldnames list --->
<cfloop list="#form.fieldnames#" index="field">
<!--- Skip these field names --->
<cfif listFindNoCase("RECIPIENT,SUBJECT,THANKURL",field) EQ 0>
<!--- NOTE: PUT the exact field name of any form field not to include in the above list --->
<!--- NOTE: If listFindNoCase() returns 0, then this field is not in the list so process it --->
... rest of the code ...
</cfif>
</cfloop>
Copy link to clipboard
Copied
Hi Ian,
We're getting there, thx for getting back to me, hope you had a great weekend:-))!
I am so not sure what caused now what, but it definately is way better now! The "form. fieldnames" repaired the order (made it just like online, and that's what I need), and after I added a finishing </cfif>, your other few lines work now too.
This is how it looks right now:
....the starting few lines...
<!--- Loop over all the field in the form.fieldnames list --->
<cfloop list="#form.fieldnames#" index="field">
<!--- Skip these field names --->
<cfif listFindNoCase("RECIPIENT,SUBJECT,THANKURL",field) EQ 0>
<!--- NOTE: PUT the exact field name of any form field not to include in the above list --->
<!--- NOTE: If listFindNoCase() returns 0, then this field is not in the list so process it --->
</cfif>
<!--- If the current form field contains a non-empty string --->
<cfif len(trim(form[field])) GT 0>
#replaceNoCase(field,"_BREAK","")#: <!--- output the field name without the string '_BREAK'--->
#repeatString(" ",20-len(replaceNoCase(field,"_BREAK","")))# <!--- Space pad the form field to 20 characters --->
#replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")# <!--- Replace all new line chr(10) characters with a new line and 17 spaces --->
<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif> <!--- if the field name contains the string '_BREAK' output a carriage return chr(13) character --->
</cfif>
</cfloop>
</cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
and that's how the TEST emails come back:
Quote Request
Sent Monday May 11, 2009 @ 2:46 PM SUBJECT:
Quote Request THANKURL:
thankyou.htm TITLE:
Mr. FIRSTNAME:
TESTfirst LASTNAME:
TESTlast TITLE2:
TESTtitle COMPANY:
TESTcompany ADDRESS1:
TESTadd CITY:
TESTcity STATE:
teststate ZIP:
12345test PHONE:
12345678test EMAIL:
TESTemail@test.com COMPRESSORMAKE_1:
TESTmake
COMPRESSORMODEL_1:
TESTmodel COMPRESSORSERIAL_1:
TESTserial COMPRESSORMAKE_2:
TESTmake2
QUANTITY_1:
1test
PARTNUMBER_1:
TESTpart DESCRIPTION_1:
TESTdesc. COMMENTS:
TEST Comment
I have a few questions:
1. How can I put the field names and the field inputs to the same row?
2. How can I make them start from the same place vertically so the email is nicely structured?
3. And it's getting tricky here: how can I make the email's sender to show the email address who made the inquiry? (..and not how it is right now: all emails come from one of our email addresses and the sender's email address only shows in the email's body)
Copy link to clipboard
Copied
Julianna01 wrote:
I have a few questions:
1. How can I put the field names and the field inputs to the same row?
2. How can I make them start from the same place vertically so the email is nicely structured
These spacing issues are from the spacing of the code. For text emails (the default) all whitespace between the opening <cfmail...> and the closing </cfmail> tags count. I put a lot of extra spaces and returns in my code examples to make it easier for you to read, and they are showing up in the messages. You just need to adjust the code to eliminate the undesired whitespace. It will make the code hard to read, but the emails nicer.
3. And it's getting tricky here: how can I make the email's sender to show the email address who made the inquiry? (..and not how it is right now: all emails come from one of our email addresses and the sender's email address only shows in the email's body)
Put the #form.email# (or whichever form field contains the desired email data) into the <cfmail ... from="#form.email#" ...> parameter.
Copy link to clipboard
Copied
Great, the sender's email is fixed now, too.
However even having deleted almost all the spaces, the lines break the same bad way, like
Sent Monday May 11, 2009 @ 2:46 PM SUBJECT:
Quote Request THANKURL:
thankyou.htm TITLE:
Mr. FIRSTNAME:
Adam LASTNAME:
Brown TITLE2:
President COMPANY: ...
Why do you think it is like that? Can't we add a break somehow after the date and time (before subject)? Maybe that would help.
Copy link to clipboard
Copied
What does your <cfmail...> tag currently look like?
Copy link to clipboard
Copied
<cfmail to="julianna@domain.com"from="#form.email#"subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
<!--- Loop over all the field in the form.fieldnames list ---><cfloop list="#form.fieldnames#" index="field"> <!--- Skip these field names ---> <cfif listFindNoCase("RECIPIENT,SUBJECT,THANKURL",field) EQ 0> <!--- NOTE: PUT the exact field name of any form field not to include in the above list ---> <!--- NOTE: If listFindNoCase() returns 0, then this field is not in the list so process it ---> </cfif><!--- If the current form field contains a non-empty string ---><cfif len(trim(form[field])) GT 0> #replaceNoCase(field,"_BREAK","")#:<!--- output the field name without the string '_BREAK'--->
#repeatString(" ",20-len(replaceNoCase(field,"_BREAK","")))#<!--- Space pad the form field to 20 characters --->
#replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")# <!--- Replace all new line chr(10) characters with a new line and 17 spaces --->
<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif><!--- if the field name contains the string '_BREAK' output a carriage return chr(13) character ---></cfif>
</cfloop></cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
Copy link to clipboard
Copied
I'm sorry, I can't tell where the real line breaks and the forums line breaks and whitespace is in that code example.
You may need to use the form's "syntax highlight" feature or upload a text file with that code fragment in it so I can see how it is really spaced.
What I am seeing I can not equate to the earlier sample of the output. There seem to not be breaks where I would expect line breaks to be and vice a versa.
Copy link to clipboard
Copied
All I did was deleting spaces, but anyways, even with deleting them, it's not enough as I need to break the lines at a different spot than where they are broken right now. How can I add that syntax highlight so you can see what I have done?
Copy link to clipboard
Copied
In the web interface this
allows you to highlight the code to make it easier to read.
Julianna01 wrote:
All I did was deleting spaces
You also need to delete the line breaks, in other words most of that code is going to end up on a single line. You may want to eliminate the comments to make that somewhat less confusing.
Copy link to clipboard
Copied
<cfmail to="julianna@domain.com"from="#form.email#"subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
<!--- Loop over all the field in the form.fieldnames list ---><cfloop list="#form.fieldnames#" index="field"> <!--- Skip these field names ---> <cfif listFindNoCase("RECIPIENT,SUBJECT,THANKURL",field) EQ 0> <!--- NOTE: PUT the exact field name of any form field not to include in the above list ---> <!--- NOTE: If listFindNoCase() returns 0, then this field is not in the list so process it ---> </cfif><!--- If the current form field contains a non-empty string ---><cfif len(trim(form[field])) GT 0> #replaceNoCase(field,"_BREAK","")#:<!--- output the field name without the string '_BREAK'---> #repeatString(" ",20-len(replaceNoCase(field,"_BREAK","")))#<!--- Space pad the form field to 20 characters ---> #replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")# <!--- Replace all new line chr(10) characters with a new line and 17 spaces ---><cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif><!--- if the field name contains the string '_BREAK' output a carriage return chr(13) character ---></cfif></cfloop></cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
Copy link to clipboard
Copied
>>
<cfmail
to="julianna@domain.com"from="#form.email#"subject="#FORM.SUBJECT#">#FORM.SUBJECT#
Sent #DateFormat(now(),'dddd mmmm d, yyyy')# @ #TimeFormat(now(),'h:mm tt')#
<cfloop list="#form.fieldnames#" index="field"> <cfif listFindNoCase("RECIPIENT,SUBJECT,THANKURL",field) EQ 0> </cfif><cfif len(trim(form[field])) GT 0> #replaceNoCase(field,"_BREAK","")#:
#repeatString(" ",20-len(replaceNoCase(field,"_BREAK","")))#
#replace(form[field],chr(10),chr(10) & repeatString(" ",17),"ALL")#
<cfif uCase(right(field,6)) EQ "_BREAK">#chr(13)#</cfif></cfif></cfloop></cfmail>
<cflocation url="#form.THANKURL#" addtoken="No">
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more