|
|
Previous<
6
7
8
9
10
11
12
13
14
> Next
|
|
The Situation: You have written some code that validates a user, then writes a cookie with the userID. Once this is done, you use <cflocation> to take the user to a main menu...but when you do so, you find the cookie was never set.
The Solution: When is a bug not a bug? Well, in this case, the behavior is unwanted, but not unexpected. But instead of dealving into the inner workings of the HTTP specification, here are two easy ways to get the desired behavior. One uses just a bit of JavaScript and the other is a pure CF solution.
|
|
|
|
What, exactly, is a function? In programming, a function is a named section of the program that performs a specific task. When called, a function performs its task, the program resumes, and the function usually returns a value.
In CFML, we use functions all the time. There are string functions such as Len, Find, and Replace. There are display functions like DateFormat and DollarFormat, and there are array functions including ArraySort, ArrayLen, and IsArray. CFML, in fact, is comprised of more functions than tags!
|
|
|
|
The Situation: You want to submit the results of a form to a pop-up window.
The Solution: First, write the Javascript function to generate the window.
function popup() { var NewWind = window.open( '','remote', 'width=350,height=400' ); if (NewWind.opener == null) { NewWind.opener = window; } }
Then, you point the form to the new window...
|
|
|
|
We'll concentrate on the fundamentals of the problem at hand. Stuff like validating form inputs, testing referers and whatnot are beyond the scope of this tutorial, although we do make use of cfqueryparam, which should be a mandatory part of all ColdFusion database operations.
Lets begin: You have a single form that is meant to update stored data (for example, a household, with the names of all of the household residents inside). This data is stored in two tables: The main address info table and a related child table that holds each resident in a unique record, like so:
|
|
|
|
Custom tags are a great tool for code reuse and portability. By developing a custom tag you not only make your current project easier but future ones as well. By providing the Developer Exchange, Macromedia provides a space for developers to share custom tags with thousands of other programmers and site builders.
ColdFusion allows developers to not only develop custom tags, but to also create tags that can wrap content, exist within other tags, and interact with other tags. This article will deal specifically with the ability to wrap content. As an example, imagine a custom tag that must take a body of text and replace any instance of an e-mail address with a hyperlink. Normally, this isn't a problem if the content comes from a database, as follows:
|
|
|
|
| Previous< 6 7 8 9 10 11 12 13 14 > Next |
|
|
|
|
|
|
|
|
|
|
|
|