List of Topics

SfC Home > Web Design > SQL > ColdFusion >

Combining ColdFusion Form and Action Pages

by Ron Kurtus (revised 21 Janaury 2022)

The common way to submit forms in ColdFusion is to use a Form Page, where you enter or select data, and an Action Page, where the result is displayed.

By using the <cfif> tag with the IsDefined function, you can combine those two pages into one.

Questions you may have include:

This lesson will answer those questions.

Two page method

The common way to submit forms in ColdFusion is to use two pages.

Form page

First, you have a Form Page, where the user can input information and click a Submit button.

<cfform method="post" action="actionpage.cfm">
<input type="submit" name="Submit">

Action page

The information is then sent to an Action Page, where the material sent from the form can be used to query a database for more information, to insert new information into the database, or perform other tasks.

Some examples are:

Combining pages

A clever way to perform both tasks on one page is to use a <CFIF> tag along with the IsDefined function to display what would be on the second page, provided the form has been submitted. The coding would be as follows:

<CFIF NOT IsDefined("form.submit")>

(Place Form Page material here. The name for the Submit button is NAME="submit".)


(Note that you could use "form.variable", for any variable sent in your submission.)

(Place material that would be in the Action Page here.)


What happens

When you first open the page, <CFIF IsDefined("form.submit")> does not apply, so the material after <CFELSE> displays.

After filling in the form and clicking the Submit button, the page refreshes and the <CFIF IsDefined("form.submit")> section is activated, while the <CFELSE> section is hidden.

The IsDefined function checks if the "submit" variable (or other defined variable) has been sent from the form. If it has, then the Action Page material can be displayed and action taken.


This method can reduce the number of pages you have in an application and can make debugging the code easy to do.

If you are reliable, you are valuable

Resources and references

Ron Kurtus' Credentials


ColdFusion Resources


(Notice: The School for Champions may earn commissions from book purchases)

Top-rated books on ColdFusion

Students and researchers

The Web address of this page is:

Please include it as a link on your website or as a reference in your report, document, or thesis.

Copyright © Restrictions

Where are you now?

School for Champions

ColdFusion topics

Combining ColdFusion Form and Action Pages

ColdFusion topics


Development methods

Specific applications

Also see

Let's make the world a better place

Be the best that you can be.

Use your knowledge and skills to help others succeed.

Don't be wasteful; protect our environment.

You CAN influence the world.

Live Your Life as a Champion:

Take care of your health

Seek knowledge and gain skills

Do excellent work

Be valuable to others

Have utmost character

Be a Champion!

The School for Champions helps you become the type of person who can be called a Champion.