House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Defaulting 2nd select related select

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
<tr>
Paul Ihrig
09/04/09 02:05 P
and the function
Paul Ihrig
09/04/09 02:06 P
got it
Paul Ihrig
09/04/09 03:24 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Ihrig
09/04/2009 02:05 PM

<tr>    <td>Territory: (id:#attributes.territory_id#)</td>    <td><cfselect enabled="Yes" name="FORMterritory_id" multiple="no"              bind="cfc:selectbox_binds.cfc.region_territorybindfunctions.GetTerritory({FORMregion_info_id})"             bindonload="true" />             </td>    </tr>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Ihrig
09/04/2009 02:06 PM

and the function <!--- Get the territory based on region ---> <cffunction name="GetTerritory" access="remote" returntype="array"> <cfargument name="region_info_id" default="" required="yes"> <cfset TerritoryList=arraynew(2)> <cfset TerritoryList[1][1] = ""> <cfset TerritoryList[1][2] = "-- Select a Territory --">   <cfquery name="qTerritory" datasource="#request.dsn#">    SELECT     territory_id, region_info_id, territory_id AS Tidx    FROM         region_territory_lookup    WHERE (region_territory_lookup.region_info_id = <cfqueryparam value="#arguments.region_info_id#" cfsqltype="cf_sql_varchar">)    ORDER BY territory_id   </cfquery> <cfset TerritoryItemcount = 1> <cfloop query="qTerritory">   <cfif Len(Trim(territory_id))>    <cfset TerritoryItemcount = IncrementValue(TerritoryItemcount)>    <cfset TerritoryList[TerritoryItemcount][1] = trim(territory_id)>    <cfset TerritoryList[TerritoryItemcount][2] = trim(Tidx)>   </cfif> </cfloop> <cfreturn TerritoryList> </cffunction> </cfcomponent>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Ihrig
09/04/2009 03:24 PM

got it.

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Ihrig
09/04/2009 02:10 PM

i can default the first select just fine. but the 2nd one is driving me nuts... http://63.144.103.199/selectbox_binds/region_territory.cfm the 2 slects part works just fine. as dowes defaulting the first cfselect <cfparam name="attributes.region_info_id" default="20"> <cfparam name="attributes.territory_id" default="13"> <!--- Initialize select boxes with values ---> <cfif (isDefined("attributes.region_info_id") AND #attributes.region_info_id# NEQ "")>     <cfajaxproxy bind="javascript:selectregion({FORMregion_info_id},'#attributes.region_info_id#')"> </cfif>   <!--- Initialize select boxes with values ---> <cfif (isDefined("attributes.territory_id") AND #attributes.territory_id# NEQ "")>   <cfajaxproxy bind="javascript:selectterritory({FORMterritory_id},'#attributes.territory_id#')"> </cfif> <script>       var selectregiondone = false;       var selectterritorydone = false;                    function selectregion(x,val) {               if(!selectregiondone) {               var dd = document.getElementById('FORMregion_info_id');               for(var i = 0; i < dd.length; i++){                 if(dd.options[i].value == val){                   dd.selectedIndex = i;                     }                 }               selectregiondone = true;               }       }              function selectterritory(x,val) {               if(!selectterritorydone) {               var dd = document.getElementById('FORMterritory_id');               for(var i = 0; i < dd.length; i++){                 if(dd.options[i].value == val){                     dd.selectedIndex = i;                       }               }               selectterritorydone = true;               }       } </script>


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference