Solved

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

Posted on 2004-10-14
6
183 Views
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.

thx!
0
Comment
Question by:neiljstandley
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:black0ps
Comment Utility
#Evaluate("Form." & paymethod)#
0
 

Author Comment

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

runtime:
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.  
0
 
LVL 7

Accepted Solution

by:
black0ps earned 50 total points
Comment Utility
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 = document.pay.PayMethod.options[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";
      }
}
//-->
</script>
<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>
</select>

<div id="invoice">Invoice code</div>
<div id="card" style="display:none;">Credit Card code</div>
</form>
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 35

Expert Comment

by:mrichmon
Comment Utility
Really all you need is

Form.Paymethod

<cfif Form.Paymethod EQ "Credit Card">
...
</cfif>

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!");
}
0
 

Author Comment

by:neiljstandley
Comment Utility
going to give these a try tomorrow, thx for the tips.
0
 

Author Comment

by:neiljstandley
Comment Utility
thx, that worked great for me.  guess it's time i start looking into javascript!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now