Skip to main content
Inspiring
February 2, 2008
Question

cfselect bond to a cfinput

  • February 2, 2008
  • 1 reply
  • 247 views
Please forgive the double post this is also posted in "General Discussion" I
realized after I posted there I should have posted this here. Thanks in
advance!!

I have a cfselect that is bound to a cfinput. It work great expect that the
cfselect does not update until the cfinput loses focus. Is there any way to
get the cfselect to update while you are typing in the cfinput? Code below.

************ cfm file ***************

<cfinput type="text" name="schname" message="Please enter your School Name"
required="yes" id="schname" value="Please Type Your School Name" size="20"
maxlength="30" />
<cfselect enabled="No" name="School" multiple="no"
value="School" display="School" bind="cfc:lookups.getschool({schname})"
></cfselect>


***************** cfc file *****************
<cfcomponent>

<cffunction name="getschool" access="remote">
<cfargument name="schname" required="yes">

<cfquery name="findschool" datasource="#client.dsn#">
SELECT School
FROM schools
where School like '#schname#%'
</cfquery>

<cfif findschool.recordcount is 0>
<cfscript>
queryAddRow(findschool);
querySetCell(findschool,'School','No Schools by that Name');
</cfscript>
</cfif>
<cfreturn findschool>
</cffunction>
</cfcomponent>




This topic has been closed for replies.

1 reply

Inspiring
February 2, 2008
Figured it out.You have to change the bind statement see below. see the
@keyup

<cfselect enabled="No" name="School" multiple="no"
value="School" display="School"
bind="cfc:lookups.getschool({schname@keyup})"></cfselect>



"Rick" <rick@di-wave.com> wrote in message
news:fo2dch$c7v$1@forums.macromedia.com...
> Please forgive the double post this is also posted in "General Discussion"
> I realized after I posted there I should have posted this here. Thanks in
> advance!!
>
> I have a cfselect that is bound to a cfinput. It work great expect that
> the
> cfselect does not update until the cfinput loses focus. Is there any way
> to
> get the cfselect to update while you are typing in the cfinput? Code
> below.
>
> ************ cfm file ***************
>
> <cfinput type="text" name="schname" message="Please enter your School
> Name"
> required="yes" id="schname" value="Please Type Your School Name" size="20"
> maxlength="30" />
> <cfselect enabled="No" name="School" multiple="no"
> value="School" display="School" bind="cfc:lookups.getschool({schname})"
> ></cfselect>
>
>
> ***************** cfc file *****************
> <cfcomponent>
>
> <cffunction name="getschool" access="remote">
> <cfargument name="schname" required="yes">
>
> <cfquery name="findschool" datasource="#client.dsn#">
> SELECT School
> FROM schools
> where School like '#schname#%'
> </cfquery>
>
> <cfif findschool.recordcount is 0>
> <cfscript>
> queryAddRow(findschool);
> querySetCell(findschool,'School','No Schools by that Name');
> </cfscript>
> </cfif>
> <cfreturn findschool>
> </cffunction>
> </cfcomponent>
>
>
>
>