I changed the getstates CFC so that it would return something no matter what
(there should always be at least one record); setting bindonload="false" on
the state dropdown caused the same error.  The problem now is that when a
country gets selected, the state dropdown doesn't change at all.  Modified
code:

Form:

<tr valign="middle">
<td align="right" class="formNotRequired">Country:</td>
 <td><cfselect name="country"
bind="cfc:site.extensions.cfc.utils.getCountries()" bindonload="true"
display="printable_name" value="country" style="width:
100%;"></cfselect></td>
 </tr>
<tr valign="middle">
<td align="right" class="formNotRequired">State:</td>
 <td><cfselect name="state"
bind="cfc:site.extensions.cfc.utils.getstates({country})" bindonload="true"
display="stateValue" value="state" style="width: 100%;"></cfselect></td>
 </tr>


CFC:

    <cffunction name="getstates" access="remote">
        <cfargument name="country" required="no" default="">
<cfquery name="getStates" datasource="#application.dsn#">
 SELECT DISTINCT FBB.state, FBB.state AS stateValue
FROM _tblFBBuilders FBB
 WHERE FBB.country = <cfqueryparam cfsqltype="CF_SQL_CHAR"
value="#arguments.country#">
 UNION
SELECT '' AS state, ' - Select State - ' AS stateValue
 ORDER BY stateValue
</cfquery>
 <cfreturn getstates>
    </cffunction>

I feel like the problem MIGHT be that the form is in a modal cfwindow.  I'm
using cfajaximport in the parent page:

<cfajaximport tags="cfform,cftextarea,cflayout-border,cflayout-tab">

and I don't see any sort of import option for cfselect in the CF9
documentation.

Thanks for the help,

Pete

On Sat, Aug 20, 2011 at 8:31 AM, Raymond Camden <[email protected]>wrote:

>
> You sure you tried bindonload=false? It looks to still be firing with
> no value. You can try editing your CFC's getStates method to make
> country optional. If the value is blank, return nothing.
>
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346877
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to