ColdFusion Tips and Tutorials

ColdFusion Tips and Tutorials. Tips on ColdFusion, AJAX, CSS, JavaScript, HTML, Design, and more.

CFUnited Developer Conference 2010
Use this code TIPSCUST to get $100 off your registration @ CFUnited! We'll see you There!


ColdFusion Tips
Page 1 2 3
148 ColdFusion, Ajax, FuseBox, Tips, and Tut
147 Included Point of View
146 Javascript - OnFocus
145 Nathan's Rules of Professional Web Desig
144 Universal Server-Side Check | Bandwidth
143 Meeting Schedule | Identification Sessio
142 Breaking Frames Without Javascript
141 Unreal Forms
140 Screen Resolution
139 Human Help
138 Better Server-Side Validation
137 Automatic Server-Side Validation
136 Regular Expression Laboratory,ColdFusion
135 Rank-Ordered Site Search
134 Building Cryptograms
133 Well-Formed Includes
132 Grouping Families for Visits
131 Display Families on a Map Grid
130 Slide Shows
129 Determine Your Database Engine
128 ColdFusion in Context: Maxlength Lies
127 Something Extra
126 Parsing Database Structure from Data Def
125 Valid Values Maintenance
124 Print 1
123 Hide Session Id
122 Downsizing Data to Access
121 Time to Load a Page, FuseBox 4
120 Order and Rank by Subset
119 Warn through E-mail & Update on Paste Sp
118 Paste Spreadsheets, ColdFusion Component
117 Review Files Having Fixed-Length Fields
116 Organized Help
115 Sequence Slider
114 Bad Bits
113 Logical Deduction
112 Whiteout
111 Forced Navigation
110 Managing Permissions
109 Time Travel
108 Test First
107 Get Distance Between Map Coordinates
106 Validating Checkboxes
105 Matrix Manipulation
104 Field Help
103 Fake Object Not Found
102 Rank Order Correlation Coefficient
101 From Calling Pairs to Calling Tree
100 Posting Notice
99 Logout Persuasion
98 Release Session Memory
97 Use Identically Named Fields
96 Web Bug
95 Password Generation
94 Core Queries
93 Use CFFTP
92 Insert, Update, and Delete
91 Stack
90 T-Value
89 Bulk Data Entry and E-mail Validation
88 Quick Reset
87 Design 1
86 Use CFFTP
85 Support Login with AutoPost
84 Login and Site Protection
83 XY Graphs in a Graphing Calculator
82 Read Encrypted Files
81 Showing Progress
80 Frugal Cross-Browser Javascript
79 Tabbed Folders
Page 1 2 3



Custom Search
ColdFusion TIPS PLUS


Issue 00118 http://www.cftipsplus.com

I. My Comments

II. ColdFusion In Context: Paste Spreadsheets
By R. Martin Ladner
martin.ladner@charter.net


III. ColdFusion Components (CFC's) Beginners Only
By Nathan Stanford




Advanced, Intensive ColdFusion Training!
Visit this site. If you have plans to get training here is a company
that provides Advanced, Intensive ColdFusion Training. Check them out.
http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus

I. Comments:

Methodologies: Other then FuseBox and CFObjects what other methodologies are in use out there? If your using a different methodology please let me know.

If you have a ColdFusion Question you would like answered please send it to me and I will try to get too it. Questions on ColdFusion MX, ColdFusion Coding, HTML, JavaScript, or any other send them in.


Keep Coding,
Nathan Stanford
http://www.cftipsplus.com

If you have suggestions for articles send them to us.
If you would like to write for cftipsplus.com
send us an email to:

NathanS<at>nsnd.com

IF YOU WANT TO BE AN AUTHOR SEND IN YOUR COLDFUSION TIPS.

Remember this is a great way to get your name known in the
ColdFusion Community.



II. ColdFusion in Context: Paste Spreadsheets
By R. Martin Ladner
martin.ladner@charter.net


Suppose your customer needs to replace tables of a page or two in size on the customer's Web site frequently. They might be grade reports. They might be poll results. Perhaps neither you nor your customer wants to hassle with uploading files. Manually retyping the data is not an option.
This tip shows that your customer can simply paste spreadsheets to the Web site and have them automatically converted to HTML tables.

Code
When you copy a rectangle of cells from Excel and paste them into a simple word processor, you get tab-delimited rows. Each row ends in a linefeed.
Put the code to accept data from the user into paste.cfm. Begin by setting a empty default for the input variable. Then set the ASCII value for a horizontal tab (9) to a variable; since it's less familiar than the value for linefeed and you need to leave a breadcrumb trail for those who will follow you.

If the input variable is not empty, build a table from its contents. To do this, set an outer loop delimited by the linefeed character, chr(10), to control the placement of tr tags. Then, set an inner loop delimited by the tab character to place the row data one piece at a time within td tags. Wrap all of this effort within a table tag, and be sure to give the table a border.


<cfparam name="form.Pastein" default="">
<cfset Tab="#chr(9)#">

<cfif len(trim(form.Pastein))>
<cfoutput>
<table border="1">
<cfloop list="#form.Pastein#"
index="TheRow" delimiters="#chr(10)#">

<tr>
<cfloop list="#TheRow#"
index="TheCol" delimiters="#Tab#">

<td>#TheCol#</td>
</cfloop>
</tr>
</cfloop>
</table>
</cfoutput>
</cfif>

Create a simple form that contains a textarea tag and a submit button. Let the value for the textarea tag be the previously submitted value (or an empty default). Use a cfoutput tag to expand it. When the Read button is selected, the page is submitted to itself.


<form name="paste" action="paste.cfm" method="post">
<cfoutput><textarea name="Pastein" rows="10" cols="70">
#form.Pastein#</textarea></cfoutput>
<input type="submit" name="do" value="Read">
</form>

Test
Open an Excel spreadsheet. Highlight and copy data. Paste it into paste.cfm, and press the Read button. If all goes well, you'll see the same data above the textarea as you copied from the spreadsheet. If you didn't get all the data you wanted, copy it again (or edit it in the textarea field) and press Read. Repeat until satisfied.

Extend
It only takes one more button and a few more lines to save the information to tab-delimited files for later parsing and display. Indeed, if the spreadsheet has an agreed-upon format, you can even use this technique to parse and post dozens of rows to a database all at once. If you can parse it, it's yours.
=Marty=



III. ColdFusion Components (CFC's) Beginners Only
By Nathan Stanford

As has been requested. I am going to try to explain CFC's and while at it explain a few other things along the way. I am going to oversimplify them for this article.



File 'sample.cfc'

<CFCOMPONENT>

<!--- Function Test1 --->
<cffunction name="Test1" access="public" returntype="string" hint="This will explain what I do">
<!--- Query that gets the List of Employees by Department. --->
<CFQUERY name="HRDeptEmployeesList" datasource="testdsn">
select *
from Employees
where Dept = '#arguments.Dept#'
</CFQUERY>
<CFRETURN HRDeptEmployeesList>
</cffunction>

<!--- Function Testxxx --->
<cffunction name="Testxxx" access="public" returntype="string" hint="This will explain what I do">
.........
More Functions
.........
</cffunction>

</CFCOMPONENT>




File 'test.cfm'

<CFINVOKE component="sample" method="Test1" returnvariable="foo">
<CFINVOKEARGUMENT name="Dept" value="PayRoll">
</CFINVOKE>

<CFOUTPUT query="foo">
#FirstName# #LastName# #ext#<BR>
</CFOUTPUT>


If you have questions please send them in I may or may not get to all of them. However I will do the best I can.



SPONSOR ADS:
This e-mail is sponsored by the following ads.


Advanced, Intensive ColdFusion Training!
Visit this site. If you have plans to get training here is a company
that provides Advanced, Intensive ColdFusion Training. Check them out.
http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus


Publisher and Creator:
Nathan Stanford,
NathanS<at>nsnd.com
http://www.cftipsplus.com

Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2002
CFTIPSPLUS.COM and NSND.COM

Permission is granted to circulate this publication via
MANUAL forwarding by email to friends provided that the text is
forwarded in its entirety and no fee is charged.

Photo of Nathan Stanford
Nathan Stanford
LinkedIn

R. Marty Ladner's
Site