Solved

Dynamic form values using CFvariable

Posted on 2000-05-02
3
167 Views
Last Modified: 2013-12-24

I am creating a form with 6 names and 30 different values.  I will use this form to tally votes to a particular question.  Currently I have created a cfquery that works within the Query Builder but not when using the form.  The Database will be driven by the ID value and then increase the corresponding vote section by 1.

I need to have the CFvariable select the value statement of the radio button and then run the cfquery stated below.


Relationship
Form value   Database ID     # of Votes
1            1               0        
2            2               0
3            3               0




<cfquery name="voteupdate" datasource="msurvey" dbtype="ODBC">
UPDATE totals SET totals.Votes = [Votes]+1
WHERE       (totals.ID = #CFvariable#);

</cfquery>



Error Diagnostic Information
Error resolving parameter CFVARIABLE
Cold Fusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:
1.      You have misspelled the parameter name, or
2.      You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.
The error occurred while evaluating the expression:
#CFvariable#
The error occurred while processing an element with a general identifier of (#CFvariable#), occupying document position (3:32) to (3:43).
0
Comment
Question by:smelt
3 Comments
 
LVL 2

Expert Comment

by:paulkd
ID: 2771145
CFVariable hasn't been assigned a value. Is VFVariable the result of a form variables - e.g. <CFSET CFVariable=Form.RadioXValue>

P.S. I haven't been able to understand what your attempting to accomplish (but this is normal for me) - could you post the form code?
0
 
LVL 1

Accepted Solution

by:
cfmrulez earned 200 total points
ID: 2771275
If I have understood, you want to put in #CFVariable# the value of the radio button selected, no?

You're accesing the bad way to the variable. The correct form is, supposing your radio button name property set to "radio_value", this:

<cfquery name="voteupdate" datasource="msurvey">
update totals
set totals.Votes = [Votes] + 1
where (totals.ID = #form.radio_value#)</cfquery>

If #form.radio_value# is a number, if not, you must put the ' before and after the variable.

Hope this helps,
cfmrulez!





0
 

Author Comment

by:smelt
ID: 2773215
Works great!  Thanx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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