Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamic form values using CFvariable

Posted on 2000-05-02
3
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 800 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/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 This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

660 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