Because you set it to 0 in the cfparam!! Scoping is the answer (as you
should always do to avoid problems like this)

<option value="#getFieldPlacementSites.FieldPlacementSiteTypeID#"<cfif
getFieldPlacementSites.FieldPlacementSiteTypeID EQ
getFieldPlacementSites.FPSiteTypeID>
selected="selected"</cfif>>#
getFieldPlacementSites.FieldPlacementSiteType#</option>

Pascal

> -----Original Message-----
> From: George Abraham [mailto:[EMAIL PROTECTED]
> Sent: 22 October 2004 16:41
> To: CF-Talk
> Subject: parameters and query values
> 
> Right,
> So who exactly wins out in the battle of the variable values?
> 
> I have a parameter declared: FPSiteTypeID
> 
> I have a query (getFieldPlacementSites) that gets a row from the
> database. One of the columns in that row is FPSiteTypeID. I also have
> a query (getFieldPlacementSiteTypes) that gets a lookup/mapping of
> these FPSiteTypeIDs
> 
> There is a select box that I offer for the client to select these
> FPSiteTypeIDs.
> 
> This is how the flow looks then.
> 
> <code>
> 
> <cfparam name="FPSiteTypeID" default="0">
> <cfquery datasource=dsn name=getFieldPlacementSites>
> SELECT blah1, blah2, FPSiteTypeID
> FROM thisTable
> WHERE someID = #ID#
> </cfquery>
> 
> <cfquery datasource=dsn name=getFieldPlacementSiteTypes>
> SELECT FieldPlacementSiteTypeID, FieldPlacementSiteType -- (notice the
> different name from FPSiteTypeID)
> FROM FieldPlacementSiteTypes
> </cfquery>
> <cfloop query=getFieldPlacementSites>
> 
> <select id="FPSiteTypeID" name="FPSiteTypeID">
> <cfloop query="getFieldPlacementSiteTypes">
>       <option value="#FieldPlacementSiteTypeID#"<cfif
> FieldPlacementSiteTypeID EQ FPSiteTypeID>
> selected="selected"</cfif>>#FieldPlacementSiteType#</option>
> </cfloop>
> </select>
> 
> </cfloop>
> 
> </code>
> 
> Well, everytime this is run, the value of FPSiteTypeID in the <cfif >
> statement comes out to be 0 (the default value) instead of the value
> from the query (getFieldPlacementSites). Why?
> 
> TIA,
> George
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.houseoffusion.com/banners/view.cfm?bannerid=11

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182333
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

Reply via email to