September 30th, 2003, 04:27 PM
CFIF question regarding SELECT forms?
I have made a change, so you can read my latest post first if you like..
I have a field in my table called weightID. I created a new table called weights with 2 fields, weightID and weightvalue
The weightID is an autonumber and weightvalue is either a No or a Yes, so there are only 2 rows total. 1=NO, 2=YES
I have built a 1 to many relationship with Access for the weightID in my first table and the weightID in my weights table.
I have a form, and I want to use a CFIF statement to determine whether a YES has been applied to the basket previously. If it hasn't, I want it to automatically select NO. The owner who maintains the baskets can determine which basket gets moved to YES.
So I previously had a CFIF statement created, but its not doing what I want.
Here is it
my sql at the top of the page is
<CFOUTPUT query="weights"><option value="#weightID#" <CFIF weights.weightID EQ "2">Selected</CFIF>>#weightvalue#</option></CFOUTPUT>
WHenever I run the select option I have, if it is EQ 2, and I choose a INSERT NEW BASKET, which does not previously have a value, it gives me YES, and I don't want that.
<CFQUERY name="weights" datasource="something">
SELECT weightID, weightvalue
In a nutshell, if I go to create a new basket, it should automatically give the value of NO or 1 because nothing previously had been stated for it to have a YES.
I have gone in my database and gave every basket a weightID of 1.
Last edited by jag5311; September 30th, 2003 at 04:38 PM.
September 30th, 2003, 04:37 PM
Ok, this is what I have accomplished...
If a basketID is provided on the page, I tell the page to set the weightID=baskets.weightID (which is strictly for UPDATING THE PAGE)
I tell it to set the value of weightID="1" so automatically, if its a new page, it sets it to NO.
So far so good. Plus, the CFIF statement is working, I have tested it by applying a weightvalue of 2, too 3 baskets. When I went to the edit pages of those 3 baskets, it showed YES for the weightvalue.
Problem is, when I go to NEW BASKET, i get an error saying weightID is undefined in BASKETS, which I have put in the if statement
<CFIF baskets.weightID EQ.....
So it doesn't like that for some odd reason. Any help?