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 00141 http://www.cftipsplus.com

I. My Comments

II. ColdFusion In Context: Unreal Forms
By R. Martin Ladner
martin.ladner@charter.net


I. Comments:

More Photos of My Family
http://www.milforddel.com/photos/index.cfm

Been busy with the New Baby but enjoying him. He is very cute. Hopefully I can find time to get more pictures on the web. I am still fighting with Comcast to get a Cable Connection at home. DSL is not available where I live. So I am STUCK with a company that does not care.

Martin's wife has had some hard times. She is mending now but not sure if things will ever be the same. I am not sure how much Martin would not want me to say but please keep both of them in your prayers as I have for months now.

Site Status (For Sale)
http://www.cftagstore.com/?page=viewtag&tagId=182
http://www.cfxtras.com/SalesComponentDetail.cfx?componentid=553

Example:
http://www.cftipsplus.com/sitestatus/index.cfm

Documentation:
http://www.cftipsplus.com/sitestatus/help.cfm


Have a good Easter,

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: Unreal Forms
By R. Martin Ladner
martin.ladner@charter.net


When you check to see if a form has been submitted, you generally check for the presence of a specific form field that won't have a value until the form has been submitted. It's a good thing you check for a specific variable in a real form; because, there are also... pause... take a deep breath... unreal forms. (Have we missed Halloween?)


Unreal Forms

Put the following code in mystery.cfm. The results may blur your perspective of what a form really is. First, check to see if "form" is defined. If it is, then check to see if "form" is a structure. If it is, then give form.Jack a value. Check to see if form.Jack is defined. Finally, check to see if a variable you haven't named is defined.

<cfif isDefined("form")>
Form is defined.
<cfif isStruct(form)>
Form is a structure.
<cfset form.Jack=92>
</cfif>
</cfif>
<cfif isDefined("form.Jack")>
Jack exists for ColdFusion.
</cfif>
<cfif isDefined("form.Mode")>
Mode is defined.
</cfif>

Browse the page. It says that you already have a form, that form is a structure, and that the structure is so real that you can add variables to it. You know the isDefined function is really working; because, it will tell you that an undefined form variable doesn't exist. Therefore, you have an unreal form.

Real Forms
Add the following code to make a real form. Surround it with cfif tags so you can turn it on and off by simply adding a query string to the URL. Let it submit to the current page by default (not specifying an action). However, be sure to set the method to post. Give it a submit button, and give it a hidden field named Mode.

<cfif isDefined("url.Real")>
<form method="post" name="Frank">
<input type="submit" name="Fred" value="Click Here">
<input type="hidden" name="Mode" value="26">
</form>
</cfif>

Browse mystery.cfm?Real=87 (or give Real any other value you like). You see a submit button. The other results are at first just the same though. Everything you've checked for is defined except for Mode.

Press the submit button. Because you didn't specify an action, the current URL including the current query string becomes the action. Now the form has been submitted and now a field that it created exists. If you remove the query string, the page reverts to its old self.

Implications
It's tempting, once you realize that a form is a structure just like any other structure, to check for the presence of the structure to determine if a form has been submitted. However, as you've just seen, the structure always exists, even if the page doesn't have a form or even if it has an unsubmitted form. This lets you use ColdFusion to assign values to form fields that may be encountered later (if ever). In the past, you checked for the existence of a specific form field, not just the form structure, in order to know if a form had been submitted. Now you know why.


=Marty=



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

Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2004
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