1 Reply Latest reply on Feb 2, 2008 11:50 AM by Newsgroup_User

    cfselect bond to a cfinput

    Level 7
      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>




        • 1. Re: cfselect bond to a cfinput
          Level 7
          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>
          >
          >
          >
          >