Web Design and Development Forums

ColdFusion - Using listboxes - Need Help!

This is a discussion on "ColdFusion - Using listboxes - Need Help!" within the Java, JSP, Cold Fusion section. This forum, and the thread "ColdFusion - Using listboxes - Need Help! are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > Java, JSP, Cold Fusion

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Mar 24th, 2008, 22:56   #1 (permalink)
Junior Member
 
Join Date: Apr 2007
Location: USA
Posts: 10
Question ColdFusion - Using listboxes - Need Help!

Hi,

I'm having an issue with HTML list boxes and ColdFusion validation. First, here is the query I'm using:

Code: Select all
 
<cfquery name="actor" datasource="ows">
SELECT *
FROM Actors
WHERE ActorID=#URL.ActorID# 
</cfquery>
And I've assigned the database fields I need to local variables with this code:

Code: Select all
<cfset NameFirst=Trim(actor.NameFirst)>
<cfset NameLast=Trim(actor.NameLast)>
<cfset Age=Int(actor.Age)>
<cfset Gender=Trim(actor.Gender)>
Later on, down on my form, I'm using an HTML <select> tag for a list box. Normally, I would just populate the list box from the database using <cfselect>, but in this case I just want to offer the option of "male" or "female."

It needs to be pre-selected so that when an actor's info is pulled up, the correct gender is already selected. This is the code I have:

Code: Select all
 
<select name="Gender">
     <cfoutput>
        <option value="Male" <cfif VARIABLES.Gender IS "Male">Selected</cfif>>Male</option>
        <option value="Female" <cfif VARIABLES.Gender IS "Female">Selected</cfif>>Female</option>
     </cfoutput>
</select>
And it's not working --- I don't know if I need the <cfoutput> tag or not... Anybody know what I'm doing wrong? The query is working, but it won't select the right gender.

Thanks,
- Keeldog
Keeldog is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 18th, 2008, 05:27   #2 (permalink)
New Member
 
Join Date: Dec 2007
Location: India
Posts: 9
Re: ColdFusion - Using listboxes - Need Help!

Hi Dear

instead of using variables.gender use simply datasourcename.gender and as far as concern of cfoutput it is only for display purposes. so in your case you use or not it does not effect on your list box.

so your code will become

<select name="Gender">
<option value="Male" <cfif actor.Gender IS 'Male'>Selected</cfif>>Male</option>
<option value="Female" <cfif actor.Gender IS 'Female'> Selected</cfif>>Female</option>
</select>

but be careful, your recordset should be return only and only one record.

enjoy
uday is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
coldfusion

« Learning Java | - »
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
help needed for Moving elements across multiple listboxes smkannan JavaScript Forum 0 Nov 13th, 2007 06:53
mp3 player with 3 listboxes and category/subcategory waterox Flash & Multimedia Forum 3 Jun 27th, 2007 15:28
Access, 3NF, ColdFusion, Excedrin jswebdev MSSQL & Access 1 May 13th, 2006 13:03
QueryOfQuery ColdFusion contiw MSSQL & Access 0 Mar 18th, 2006 19:39
Coldfusion Developer Position lintasllc Job Opportunities 0 Dec 15th, 2005 19:55



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 23:06.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59