1 Reply Latest reply on May 14, 2009 7:15 AM by Bert.Dilliën

    select binding failing

    newchickinCF

      hi i have a coldfusion code in which the binding is failing and the value is not being retrived from database, i really do not know why?

       

      first of all i will tell my table structutre

       

      id, state, city in table zips

       

      now i use the following code to bind the expression:

       

      <tr><td><strong>State</strong></td>
      <td><select name="state" class="textfield_effect">
      <cfoutput query="getData">
      <option value="#sstate#">#sstate#</option>
      </cfoutput>
      </select>
      <cfselect name="city" bindOnLoad="yes" bind="cfc:cfc.statecity.CitySelect({State})"/>
      </td>
      </tr>

       

      now the cfcfunction is in below window:

       

      i invoke the getdata as:

       

      <cfinvoke component="#request.cfcPath#.tools" method="gData" newf="1" returnvariable="getData"/>

       

      what in getdata is as:

       

      <cffunction access="public" name="gData" returntype="query">
      <cfargument name="newf" default="" required="no">
      <cfset var myset = "">
      <cfquery name="myset" datasource="#request.dsn#">
      <cfif isdefined('arguments.newf') and arguments.newf eq 1>
      SELECT DISTINCT(state) as sstate
      from zips
      GROUP by state
      <cfelse>
      SELECT * from zips
      </cfif>
      </cfquery>
      <cfreturn myset>
      </cffunction>

       

      <cfcomponent>
      <cfproperty name="name" type="string">
      <cffunction name="CitySelect" access="remote" returntype="array">
      <cfargument name="State" type="string" required="true">
      <cfquery name="myset" datasource="#request.dsn#" username="#request.user#" password="#request.pass#">
      SELECT city,state
      FROM zips
      WHERE State = <cfqueryparam cfsqltype="cf_sql_varchar" value="#state#">
      </cfquery>
      <cfset list = arraynew(2)>
      <!--- Convert results to array --->
      <cfloop index="i" from="1" to="#myset.RecordCount#">
      <cfset list[i][1]= myquery.state[i]>
      <cfset list[i][2]= myquery.city[i]>
      </cfloop>
      <cfreturn list>
      </cffunction>
      </cfcomponent>

       

      when i see from firebug, i see the this

       

      []

       

      with no value.

       

      i debugged and found this error:

       

      error:bind: Element not found: State

       

      error:bind: Bind failed, element not found: State

       

      please guide me