Mandarin Logo
MainBlogFAQsBox TipsText TricksColor ChartFree GalleryCSS Opacity
TWO CENTS CURRENT ISSUE 2005 | DEC| JAN| FEB WEST SACRAMENTO CALIFORNIA USA

ColdFusion Help

September 2004

ColdFusion Developer's Journal The only monthly ColdFusion magazine available in both Web and hardcopy. Now monthly, the CFDJ offers articles, Job banks, and developer forums.

Still Using ColdFusion 5?

May 2004 Tips for CFMX-ifying ColdFusion 5 Applications
This new article will help you understand new strategies for your old applications (there's a TRY and a BUY on the tutorial page). And the author, Raymond Camden has a ColdFusion related blog. The Blog is here and is being updated on a regular basis (as of today).

Resouces

Regex to Match a URL

How about a Regex to Match a URL? It's as simple as this.

https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?

Hot Links to Cold Fusion Sites

Builder.com ColdFusion Articles



August 2002

It's August and time for some udating. Join us in the search for ColdFusion articles, tutorials, and tips. What's New in ColdFusion Server 5 is an excellent article and part tutorial, including a download of sample files.

A site that has some potential is webmasterbase. But, today it is adverstising a How to Build Your Own Database Using PHP and SQL book.

Alternating Row Color

Everyone has their own recipe for alternating the background row color. Here's one from SitePoint Tutorial:

<STYLE TYPE="text/css">  
<!-- 
.row0 {background-color: green;}  
.row1 {background-color: white;}  
-->  
</STYLE>  
<TABLE>  
<CFOUTPUT QUERY="QueryName">  
<CFSET class="row#Int(QueryName.CurrentRow MOD 2)#">  
<TR class = #class#>  
<TD>#Field1# 


Tutorials


Quick Tips


Documentation


Forums - Sites that are Updated Daily

If misery loves company then the Forums are the place to be. Some ColdFusion questions get 5 or 10 answers while others sit alone. You might find the answer to your question without even having to post it.

If you want to post a new question you can create a Macrodmedia Online Forums ColdFusion account.

  • Tek-Tips Forum for ColdFusion Tek-Tips is current and very active today - May 2004. This is the most happening site we can find today.
  • Go Directly to the Macromedia ColdFusion Forum Questions and answers were posted all day every day a couple of years ago.
    
    August 12, 2002
    There are currently 50 users logged in at noon. 
    
    May 2004
    Today there are 2 users online.  
    
    


  • CFHub.com Forum
    ColdFusion Hub is current and active (May 2004). This site includes the Question and Answers for the topics CFMAIL, SQL, WDDX and CFSCRIPT.

    <

    This site includes tips like how to alternate the color of the table rows.

    
    <cfquery data source="YourODBCDatasource" name="getData">
    Select * from YourTable
    </cfquery>
    
    <cfset RowColor="">
    <cfset RowColor1="3399cc">
    <cfset RowColor2="d0d0d0">
    
    <table>
      <cfoutput query="getData">
      
    <cfif (getData.CurrentRow mod 2) is 0>
      <cfset RowColor=RowColor1>
    <cfelse>
      <cfset RowColor=RowColor2>
    </cfif>  
      
      <tr bgcolor="#RowColor#">
        <td>#Column1#</td>
        <td>#Column2#</td>
        <td>#Column3#</td>
        <td>#Column4#</td>
      <tr>
      </cfoutput>
    </table>
    
    
    And here's another version.
      
      <TABLE CELLPADDING="2" CELLSPACING="2" BORDER="0"> 
      <TH>FirstName</TH> <TH>LastName</TH> <TH>Favorite Band</TH>
      <CFOUTPUT QUERY="retreive_users">
      <TR BGCOLOR=###IIF(get_users.currentrow MOD 2, DE ('FFFFFF'), DE ('7DEDF7'))#>
      <TD>#FirstName#</TD> <TD>#LastName#</TD> <TD>#Favourite_Band#</TD>
      </TR>
      </CFOUTPUT>
      </TABLE>
    
  • defusion.com Discussions Somewhat active. Worth mentioning for the articles.

ColdFusion FAQ's and More...

Sites that are so-so

ColdFusion Defined

CFML
Short for ColdFusion Markup Language, a proprietary mark up language developed for use with ColdFusion.

CFML is a tag-based Web scripting language that supports dynamic Web page creation and database access in a Web server environment.

ColdFusion tags that look a lot like HTML tags are embedded in HTML files that have the file extension .cfm. The HTML tags determine the page layout while the CFML tags import content based on user input or the results of a database query.

Tip of the Day for Beginners

Select a date from a calendar?
Date Select Popup

Here's what the page says:

"Would you like to give users to your site the option to select a date from a calendar?

Click on the Calendar icon next to the form field to select a date and have the value automatically populate your form field.

* Due to many requests, I've added two date fields to this example, start and end. I've also changed the code so that you pass the name of the form and the date field to the JavaScript function. That way you don't need to change them on the pop-up window.:"

Gosh, I sure hope this is current code. How can we know when we are using outdated code?

Server-side Embedded Form Validation
Validation Rule _required
Validation after the form is submitted

In ColdFusion you can use hidden fields for form validation. Hidden form fields go to a user's browser like the rest of the form fields. But, the hidden fields are not displayed.

When a user submits a form, the hidden fields are sent to the server along with the rest of the form fields.

To use hidden form fields to validate, add a hidden field to the form. Use the same name as the field you want to validate.

Validation Rule
Example 

lastname
Hidden field name: lastname_required

<input type="hidden" name="lastname_required" value="Last name is required">

ColdFusion validation takes place on the server after the form is submitted.

That means that you will not be able to tell the user about the invalid entry until the entire form has been submitted.

The built-in validation rules are as follows: _date _required _eurodate _float _integer _range _time

The benefit in using ColdFusion field validation rules is that an error message is automatically displayed.

Client-Side Form Validation
<CFFORM>
Validation before the form is submitted

Client-side validation means that you write code that the customer's browser will execute. The validation will take place before the form is submitted. Most developers use JavaScript because it is supported by both IE and Netscape. VBScript can be used if all of your customers use IE.

CFFORM automatically creates the JavaScript foundation code for you. You only know it is there by viewing the source code in your browser.

The JavaScript validation executes before the form is submitted to the server.

<CFINPUT>
The CFINPUT tag is coded very much like the INPUT tag.
   <CFINPUT TYPE="TEXT" NAME="CompletedDate"  size="10" VALIDATE="date" 
	value="#dateformat(todayDate, "mm/dd/yyyy")#"  
	MESSAGE="Please enter a valid Completed date (i.e. 12/31/2002)">
But, under the cover ColdFusion automatically creates elaborate JavaScript for this example. You only see it if you view your source code.
Debugging
We use this code often. Add the code to any ColdFusion form action page to see each field name and the value passed from the form page to the action page.
  
<CFLOOP LIST = "#FORM.FieldNames#" INDEX = "ThisField">
<CFOUTPUT>
The value of FORM.#ThisField# is #Evaluate("FORM."& ThisField)#<BR>
</CFOUTPUT>
</CFLOOP>
How do you force an unlock in Access?
You write a query that makes a call to a non-existent field in a table. This will cause an error that breaks the database lock.
 

<A HREF="breaklock.cfm"><strong>Break Lock</strong></A>

The contents of breaklock.cfm are as follows:

<html>
<head>
<title>Break Lock Query</title>
</head>

<body>
<CFQUERY NAME="Breaklock" DATASOURCE="nssdata">
SELECT nofield FROM changetype
</CFQUERY>
</body>
</html>



SQL Tip

If you are using ColdFusion Studio, you can use the Query Builder to build SQL statements by graphically selecting the tables and records within those tables that you want to retrieve.

Back to Top   Back to Main     Back to Web Help