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

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.

Who is Participating?
black0psConnect With a Mentor Commented:
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>
#Evaluate("Form." & paymethod)#
neiljstandleyAuthor Commented:
<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.  
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

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!");
neiljstandleyAuthor Commented:
going to give these a try tomorrow, thx for the tips.
neiljstandleyAuthor Commented:
thx, that worked great for me.  guess it's time i start looking into javascript!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.