Error: Value can not be converted to requested type

This was an interesting error that I encountered today. About two months ago, I added a bunch of cfqueryparams to the page that began returning this error today, "Error Executing Database Query. [Macromedia][SQLServer JDBC Driver]Value can not be converted to requested type.". I assumed the value being passed to the cfqueryparam was actually invalid.

[More]

Using CFHTMLHEAD

Last week one of my team members gave a presentation to the rest of us on Coldbox. We are using this framework for a project and we were discussing the basics of convention and how to work with the different layers - which brought up the question, where exactly is the optimal place to put the Javascript in this?.

I used this opportunity to bring up the CFHTMLHEAD tag, which allows you to place code into the head tag from anywhere on the page. This would allow us to keep Javascript from loading on unnecessary pages and still keep everything componentized. I also thought this would be a good opportunity to discuss basic CFHTMLHEAD usage.

[More]

Cfmail in cfscript

Cfmail in cfscript Here's a convenient little function I use for some of my more processing oriented pages. I love building content in cfscript however I find it really annoying having to close my cfscript tags to mail content. In general I don't like closing cfscript tags for anything if at all possible.

[More]

CFLocation and HTTP Referer

I ran into a situation this past week where I wanted to forward a user from one page to another page then send the user back to the original page (using CFLocation). While attempting this, the page that we CFLocation to was returning a blank cgi.http_referer value (I was expecting it to return the HTTP Referer as the page that had the CFLocation on it).

[More]

Sending MultiPart Email Messages with ColdFusion

Here is an example of how to send a multipart email message with ColdFusion:


<cfmail subject="MultiPart Email Test" type="text/html" to="you@test.com" from="someone@test.com">
<cfmailpart type="text/plain">
Plain text goes here
</cfmailpart>
<cfmailpart type="text/html">
HTML version goes here
</cfmailpart>
</cfmail>

It's important that you put the text-only version of the message FIRST in the mailpart tag list, otherwise GMail will always display the text-only version of the email message and never display the HTML version of the message!

404 Pages in Coldfusion

First off, let me define what exactly a 404 page is. An HTTP 404 error message is a standard response code indicating that the client was able to communciate with the server but the server could not find the page requested. In Coldfusion, by default, the server (IIS) doesn't check that .cfm files exist but rather lets Coldfusion handle that. The result is one of those ugly blue and grey error screens that aren't picked up by the normal 404 methods or by our Application.cfm's error handler.

[More]

Using CFHeader to hide file paths

Recently, while working on a project, I was tasked with hiding the source path of downloadable content.  I knew that if I passed the filepath anywhere on the server it wouldn't be secure.  A great tag to use if you don't want to share file paths, or if you want to store files in somewhere other than the webroot folders is the ""CFHeader" tag.  CFHeader sets the content header and in this case can be used to change how the file is grabbed from a server.  One can even make images download by default instead of loading in the browser.

[More]

Debugging Javascript using Firebug in Browsers other than Firefox

Here is a neat Javascript tool that I recently discovered: Firebug Lite – a Javascript library that integrates Firebug into the DOM of any browser (like Internet Explorer, Chrome and Safari).

[More]

Signature Travel Network and Food Network partner on exclusive travel specials

Congratulations to Ravenglass client Signature Travel Network! They have partnered with Food Network and will be the exclusive provider of that brand's travel-related offerings!

http://www.travelpulse.com/Resources/Editorial.aspx?n=64468

 

Validating data types and values with CFPARAM

Here's a helpful hint for validating data in CFML pages. You can use CFPARAM attributes to specify the data type and even value validation with regular expressions.

When the "type" attribute is "regex", you can incorporate any regular expression to validate the value in the variable. CFPARAM will throw an error if the "default" attribute is not provided and the variable doesn't exist. If the variable does exist, CFPARAM validates its value against the regular expression and throws an error if the value doesn't conform.

For example, here's how to use CFPARAM to check for a comma-separated list of whole numbers:

<cfparam name="URL.listtest" pattern="^(?:-?[0-9]+)(?:\,(?:-?[0-9]+))*$" type="regex">

You can also use the "type" attribute to validate simple types such as "integer" and "string" or to validate more complex types like phone numbers and dates. For more information see the CFPARAM reference pages.

 

 

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner