Did you try putting a space before the word 'SELECTED' in your option tag?
If not, I think that is your problem.
HTH
Jeff
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: None
To: Fusebox
Subject: Select box bug?
This seems like a possible bug but of course my code is always suspect.
I am creating a series of select boxes from a query. These boxes are a list
of
possible categories to associate with an article. When I pull up an article,
it should display select boxes for each associated category and have the
correct category selected. For example, article 1 is associated with
category
Bo-L-1 and category Bo-S-2. So the drop down boxes should have these
categories seleceted as well as listing all other possible categories.
The code below works except that the select boxes all display the first
category as the selected one even though the correct category displays
outside
of the select box.
Any thoughts?
Ian
<CFLOOP QUERY="getArticleSubjects">
<TR>
<TD>
Category <CFOUTPUT>#Variables.subjectCount#:
<!--- Display the current article category --->
#getArticleSubjects.CategoryCode#_#getArticleSubjects.SubcategoryCode#_#getA
rtic
leSubjects.SubjectCode#</CFOUTPUT>
<CFSELECT NAME="Category_#subjectCount#">
<OPTION VALUE=""></OPTION>
<CFOUTPUT QUERY="Application.adminGetSubject">
<!--- Check to see if the current category in the list matches the current
article category ---> <CFIF
"#Application.adminGetSubject.CategoryCode#_#Application.adminGetSubject.Sub
cate
goryCode#_#Application.adminGetSubject.SubjectCode#"
EQ
"#getArticleSubjects.CategoryCode#_#getArticleSubjects.SubcategoryCode#_#get
Arti
cleSubjects.SubjectCode#">
<OPTION
VALUE="#Application.adminGetSubject.CategoryCode#_#Application.adminGetSubje
ct.S
ubcategoryCode#_#Application.adminGetSubject.SubjectCode#"
SELECTED>#Application.adminGetSubject.CategoryCode#_#Application.adminGetSub
ject
..SubcategoryCode#_#Application.adminGetSubject.SubjectCode#</OPTION>
<CFELSE>
<OPTION
VALUE="#Application.adminGetSubject.CategoryCode#_#Application.adminGetSubje
ct.S
ubcategoryCode#_#Application.adminGetSubject.SubjectCode#">#Application.admi
nGet
Subject.CategoryCode#_#Application.adminGetSubject.SubcategoryCode#_#Applica
tion
..adminGetSubject.SubjectCode#</OPTION>
</CFIF>
</CFOUTPUT>
</CFSELECT>
</TD>
<TD COLSPAN="4">
<!--- Display the current article category names--->
<CFOUTPUT>#getArticleSubjects.Category#_#getArticleSubjects.SubCategory#<CFI
F
getArticleSubjects.Subject NEQ
"Z">_#getArticleSubjects.Subject#</CFIF></CFOUTPUT>
</TD>
</TR>
<CFSET subjectCount = subjectCount + 1>
</CFLOOP>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists