ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 30th, 2003, 03:27 PM
jag5311 jag5311 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 jag5311 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 5
CFIF question regarding SELECT forms?

-----EDIT------
I have made a change, so you can read my latest post first if you like..

-----EDIT------


Hi,

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

Code:
<select name="weights">
<CFOUTPUT query="weights"><option value="#weightID#" <CFIF weights.weightID EQ "2">Selected</CFIF>>#weightvalue#</option></CFOUTPUT>
</select>


my sql at the top of the page is

Code:
<CFQUERY name="weights" datasource="something">
SELECT weightID, weightvalue
FROM weights
</CFQUERY>


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.

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 03:38 PM.

Reply With Quote
  #2  
Old September 30th, 2003, 03:37 PM
jag5311 jag5311 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 jag5311 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 5
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)

ELSE

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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > CFIF question regarding SELECT forms?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway