Reference value within Form page (as opposed to Action page)

Posted on 2004-10-14
Last Modified: 2013-12-20
ColdFusion 5.0

<td bgcolor="eeeeee"> <cfselect size="1" name="PayMethod">
                <option selected value="Invoice">Renewal</option>
                <option value="Credit Card">Credit Card</option>
              </cfselect> </td>

I wish to reference the value within the current page so as to determine what other code to display.  All of my research on the net results in FORM.#paymethod# but I need the value before it is passed to the Action page.

Question by:neiljstandley
  • 3
  • 2

Expert Comment

ID: 12313549
#Evaluate("Form." & paymethod)#

Author Comment

ID: 12314009
<td bgcolor="eeeeee"> <cfselect size="1" name="PayMethod">
                <option selected value="Invoice">Renewal</option>
                <option value="Credit Card">Credit Card</option>
              </cfselect> </td>
<cfif #Evaluate("Form." & paymethod)# is "Credit Card">

Error resolving parameter PAYMETHOD

ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:

You have misspelled the parameter name, or
You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.
Paymethod is the correct name, the action page inserts data to the DB w/the same name.  

Accepted Solution

black0ps earned 50 total points
ID: 12314027
I need to back up a second. I reread your question and i think I know what you mean. What you actually want is Javascript or client-side code, not server-side.

<script language="JavaScript">
function displayStuff(x) {      
      x =[x].value;
      if (x == "Invoice") {
            document.getElementById('invoice').style.display = "block";
            document.getElementById('card').style.display = "none";
      else if (x == "Credit Card") {
            document.getElementById('invoice').style.display = "none";
            document.getElementById('card').style.display = "block";
<form name="pay">
<select size="1" name="PayMethod" onChange="displayStuff(this.options.selectedIndex)">
<option value="Invoice">Renewal</option>
<option value="Credit Card">Credit Card</option>

<div id="invoice">Invoice code</div>
<div id="card" style="display:none;">Credit Card code</div>
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

LVL 35

Expert Comment

ID: 12314034
Really all you need is


<cfif Form.Paymethod EQ "Credit Card">

But that is after the form is submitted.

If you want the value before the form is submitted you need javascript.

if(document.yourformname.paymethod.value == "Credit Card")
alert("You selected credit card!");

Author Comment

ID: 12314093
going to give these a try tomorrow, thx for the tips.

Author Comment

ID: 12341182
thx, that worked great for me.  guess it's time i start looking into javascript!

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wordpress email form 23 82
.htaccess rewrite url with querystring problem 13 102
exchange 2010 turning off 3des ciphers 2 319
setup wamp server for first time 2 83
A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and Log…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question