I have two cfselect boxes that use binds and a cfc. One is State. Choose a State, and the second cfselect (counties) is populated on the fly.
Prior to doing this with the bind attribute, I relied on the queryPostion="below" attribute such as the following to basically put a blank row into the option box. I want to do the same thing for both the State and County select boxes now, as I'd like to have "" values (or an "ALL" value as an option in each. But queryPostion no longer works. I'm not sure of a work-around.
//original... leaves a blank option:
<cfselect enabled="No" name="search_state" multiple="no" query="get_States" value="StateUSAbb" display="StateName" queryPosition="below">
<option></option>
</cfselect>
//now, w/bind, doesn't work:
<cfselect bind="cfc:states.getStates()" bindonload="true" name="search_state"
value="StateUSAbb" display="StateName">
</cfselect>
<cfselect bind="cfc:states.getCounties({search_state})" bindonload="true" name="search_county" value="FIPS_County" display="CountyName" >
</cfselect>
UPDATE Solution for both queries:
SELECT DISTINCT tblLoc.StateUSAbb, lkuState.StateName
FROM lkuState INNER JOIN tblLoc ON lkuState.FIPS_State = tblLoc.FIPS_State
WHERE (lkuState.StateName <> 'New Brunswick')
UNION
SELECT '' AS StateUSAbb, '' AS StateName
FROM lkuState
ORDER BY StateName
SELECT '' AS FIPS_COUNTY, '' as CountyName
FROM lkuCnty
UNION
SELECT FIPS_County, CountyName
FROM lkuCnty
WHERE StateAbb = '#ARGUMENTS.stateabb#'
ORDER BY CountyName