You can't use the selected attribute unless you are also using the query
attribute in cfselect.
Since you are looping over the query and outputting the <option> tags
directly you'll need to add a cfif check. Like this
<cfselect name="ceilingPaint#i#">
<option value="">Select One</option>
<cfloop query="paintList">
<option value="#JobPaintListId#" <cfif JobPaintListId eq
2>selected="true"</cfif> >#PaintList.colorName#,...</option>
</cfloop>
</cfselect>
Hth,
--nimer
> -----Original Message-----
> From: Mark Fuqua [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 26, 2005 9:47 AM
> To: CF-Talk
> Subject: Help with cfselect
>
> Good Morning,
>
> I am having trouble with the "selected" attribute of the <cfselect>
tag.
> I
> am trying to get it to display what is currently in the table if there
is
> a
> value already there or "select one" if there currently is no value.
>
> I started out with the <select> tag, but it doesn't seem to have a
similar
> attribute. So, I tried the <cfselect>. It is working as I need,
except
> the
> existing value is not selected.
>
> Any help would be appreciated.
>
> Thanks,
>
> Mark
>
>
> Here is the code on my page:
>
>
> <cfquery name="areaPaints" datasource="mdfinish">
> SELECT AreaId, AreaName, WallPaint, TrimPaint, CeilingPaint
> FROM Areas
> WHERE areas.JobId = #session.JobId#
> </cfquery>
>
> <cfquery name="paintList" datasource="mdfinish">
> SELECT JobPaintList.color, JobPaintList.JobPaintListId,
> JobPaintList.CustomColorName, PaintColor.ColorName,
> PaintColor.colorNumber,
> JobPaintList.line,
> JobPaintList.sheen, JobPaintList.manufacturer,
PaintLines.PaintLineName,
> PaintSheen.PaintSheen
> FROM PaintSheen INNER JOIN (PaintLines INNER JOIN (PaintColor INNER
JOIN
> JobPaintList ON PaintColor.ID = JobPaintList.color) ON
> PaintLines.PaintLineId = JobPaintList.line) ON PaintSheen.PaintSheenId
=
> JobPaintList.sheen
> WHERE JobPaintList.job = #session.jobId#
> </cfquery>
>
> <cfmodule template="#Request.layout#/Header.cfm" pageType="JobAdmin">
> <cfset i=1>
> <cfform name="setcolor" action="paintScheduleSetColorsAction.cfm">
>
> <table width="100%">
> <tr>
> <th>Area Name</th>
> <th>Wall Paint</th>
> <th>Ceiling Paint</th>
> <th>Trim Paint</th>
> </tr>
> <cfoutput>
> <cfloop query="areaPaints">
> <tr><cfset i = i + 1>
> <td>#areaName#</td>
> <td>
> <cfselect name="wallPaint#i#" >
> <option value="">Select One</option>
> <cfloop query="paintList">
> <option value="#JobPaintListId#">#PaintList.colorName#,
> #Paintlist.ColorNumber# #PaintList.PaintLineName#
#PaintList.PaintSheen#
> #PaintList.CustomColorName#</option>
> </cfloop>
> </cfselect>
>
>
> </td>
> <td>
> <cfselect name="ceilingPaint#i#"
> selected="#areaPaints.ceilingPaint#" >
> <option value="">Select One</option>
> <cfloop query="paintList">
> <option value="#JobPaintListId#">#PaintList.colorName#,
> #Paintlist.ColorNumber# #PaintList.PaintLineName#
#PaintList.PaintSheen#
> #PaintList.CustomColorName#</option>
> </cfloop>
> </cfselect> </td>
> <td>
> <cfselect name="trimPaint#i#" >
> <option value="">Select One</option>
> <cfloop query="paintList">
> <option value="#JobPaintListId#">#PaintList.colorName#,
> #Paintlist.ColorNumber# #PaintList.PaintLineName#
#PaintList.PaintSheen#
> #PaintList.CustomColorName#</option>
> </cfloop>
> </cfselect> </td>
>
> </tr>
> </cfloop>
> </cfoutput>
> <tr>
> <td>
> </tr>
>
> </table>
>
> <button type="submit">submit</button>
> </cfform>
> <cfmodule template="#Request.layout#/Footer.cfm"><cfmodule
> template="#Request.layout#/Footer.cfm">
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219619
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54