Hi all...

this is my code...one of the first I wrote, so I'm sorry it's a bit wordy
and sloppy...

I wrote this before we got hooked into fusebox arch.

we had to write a three tier one... I hope this helps...I have a two tier
one as well if you want it, just let me know

This is the three tier version...

you can email me direct ([EMAIL PROTECTED]) with any
questions/comments if you want.

yt,

Ethan

<!--inc_fabric_pull_b.cfm-->

<!--- include for dual drop down based on ObjectGroup_ID and Product --->
<cfparam name="CusGoodType_ID" default="no_choice_yet">

<script language="JavaScript">

function surfto(f) {
    myindex=document.forms[f].elements[2].selectedIndex;
    location=document.forms[f].elements[2].options[myindex].value;
    return true;
}

function surftoto(f) {
    myindex=document.forms[f].elements[3].selectedIndex;
    location=document.forms[f].elements[3].options[myindex].value;
    return true;
}
</script>


<!--- First select box query info  --->
 <cfquery name="FirstSelect" datasource="A_Com_ACB2_Main2" dbtype="ODBC">
  SELECT      CusGoodType_ID, CusGood_Name
  FROM         CustomGoodType
 </cfquery>

<!--- After first drop down is made, sets first select box to that
selection --->
<CFIF ParameterExists(form.CusGoodType_ID) AND form.CusGoodType_ID NEQ "">
  <cfquery name="FirstLoad" datasource="A_Com_ACB2_Main2" dbtype="ODBC">
   SELECT      CusGoodType_ID, CusGood_Name
   FROM        CustomGoodType
   Where   CusGoodType_ID = #form.CusGoodType_ID#
  </cfquery>

 <cfoutput query="FirstLoad">
  <cfset LastSelected="#CusGood_Name#">
 </cfoutput>
</cfif>

<!--- set top select box to selection on reload for Edit Forms --->

<CFParam Name=DefaultSelectMessage default="Select Product Description">
<CFParam Name=DefaultSelectID Default="0">



<!--- end set top select box to selected --->

<!--- start table for form --->


    <!--- Field: Description --->
    <TR>
    <TD>* Description
  &nbsp;<a href="#" class="link2"
onClick="MM_openBrWindow('Http://216.75.69.42/theatre/Theatre.cfm','Theatre'
,'width=400,height=450')">(info)</a>
  </TD>
    <TD>


  <select name="CusGoodType_ID" class="text2"
onchange='document.CustGood.submit();'>
   <cfif ParameterExists(form.CusGoodType_ID) AND form.CusGoodType_ID NEQ
"0">
    <cfoutput>
     <option value="#CusGoodType_ID#" selected>* #LastSelected#</option>
    </cfoutput>
   <cfelse>
    <cfoutput>
        <option value="#DefaultSelectID#">#DefaultSelectMessage#</option>
    </cfoutput>
     </cfif>
     <cfoutput query = "FirstSelect">
       <cfif IsDefined('RecordID')>
        <option
value="#CGI.PATH_INFO#?CusGoodType_ID=#CusGoodType_ID#&RecordID=#RecordID#">
#CusGood_Name#</option>
      <cfelse>
        <option value="#CusGoodType_ID#">#CusGood_Name#</option>
    </cfif>
    </cfoutput>
  </select>

<!--- end first select box --->
</td>
</tr>

<!--- begin second select box --->



<!--- To Preload second select box for Edit sequence --->
<!--- First Set default
  second check to see if there is a specific record to check via the URL
scope --->

<CFParam Name=SecondSelectMessage default="Select Description First">
<CFParam Name=SecondSelectID default="0">
<CFIF ParameterExists(url.RecordID)>
 <CFOutput query="GetRecord">
  <CFset SecondSelectMessage = #ProductTitle#>
  <CFset SecondSelectID = #SKU#>
 </cfoutput>
</cfif>

<!--- query to fill second select with products --->
<CFIF ParameterExists(form.CusGoodType_ID)>
  <cfquery name="SecondSelect" datasource="A_Com_ACB2_Main2">
   SELECT      CustomGoodFabric.CusGoodType_ID,
CustomGoodFabric.CusGoodFabric_ID, CustomGoodFabric.Product_ID,
Products.ProductTitle
   FROM        CustomGoodFabric, Products
   WHERE       CustomGoodFabric.Product_ID = Products.Product_ID AND
                   (CustomGoodFabric.CusGoodType_ID = #form.CusGoodType_ID#)
  </cfquery>


</cfif>

<!--- query to reload second select on selection --->
<cfif ParameterExists(form.Product_ID)>
  <cfquery name="SecondLoad" datasource="A_Com_ACB2_Main2">
   SELECT      CustomGoodFabric.CusGoodType_ID,
CustomGoodFabric.CusGoodFabric_ID, CustomGoodFabric.Product_ID,
Products.ProductTitle
   FROM        CustomGoodFabric, Products
   WHERE       CustomGoodFabric.Product_ID = Products.Product_ID AND
                   (CustomGoodFabric.CusGoodType_ID = #form.CusGoodType_ID#)
AND Products.Product_ID = #form.Product_ID#
  </cfquery>

  <cfset info_link="Product_ID=#SecondLoad.Product_ID#">

</cfif>

<!--- second select box ---->
<tr>
 <td>* Fabric Type
  <cfif ParameterExists(info_link) AND Product_ID NEQ 0>
   <cfoutput>
    &nbsp;<a href="##" class="link2"
onClick="MM_openBrWindow('http://216.75.69.42/A_Com/showdetl.cfm?&DID=6&CATI
D=1&#info_link#&HideNav=yes','fabric','location=no,status=yes,menubar=no,scr
ollbars=yes,resizable=yes,width=520,height=400')">(info)</a>
   </cfoutput>
  </cfif>
 </td>
<td>


<select name="Product_ID" class="text2"
onchange='document.CustGood.submit();'>

<!--- conditional to preload chosen fabric --->

<cfif ParameterExists(form.Product_ID)>
 <cfif form.Product_ID eq 0>
  <cfoutput>
   <option value="#SecondSelectID#">Select Fabric</option>
  </cfoutput>
 </cfif>
 <cfoutput query="SecondLoad">
  <option value="#Product_ID#">* #ProductTitle#</option>
 </cfoutput>
</cfif>


<cfif ParameterExists(form.CusGoodType_ID)>
 <cfif NOT ParameterExists(form.Product_ID)>
  <option value="0">Choose Fabric</option>
 </cfif>
 <cfoutput query="SecondSelect">
     <option value="#Product_ID#">#ProductTitle#</option>
 </cfoutput>

  </select>
<cfelse>
 <cfoutput>
  <option value="#SecondSelectID#">#SecondSelectMessage#</option>
 </cfoutput>

  </select>
</cfif>

 </TD>
</TR>
<!--- end second select box  --->


<!--- Third Select Box Start --->
<CFParam Name=ThirdSelectMessage default="Select Fabric First">
<CFParam Name=ThirdSelectID default="0">

<!--- query to load third select box --->
<cfif ParameterExists(form.Product_ID)>
 <cfquery name="ThirdSelect" datasource="A_Com_ACB2_Main2">
  SELECT Options.Opt_ID, Options.OptTitle,
Options.OptPartNumber,Options.OrderByString, Options.OptPrice,
Options.Company_ID,
    Options.OptLevel, Options.OptWeight, productoptions.Product_ID
  FROM options INNER JOIN productoptions ON options.Opt_ID =
productoptions.Opt_ID
  WHERE ((productoptions.Product_ID)=#form.Product_ID#) AND OptPartNumber
NOT LIKE '%Title%' AND OptLevel = 2
    Order by OrderByString, OptTitle
 </cfquery>
</cfif>

<TR>
 <TD>
  &nbsp;&nbsp;Color
 </TD>
 <td>
<!--- Third select box --->
   <select name="CusGood_Color" class="text2">
<!--- conditional to preload chosen color #############don't need hit submit
and your gone ######## when go to edit form make new query
 <cfif ParameterExists(URL.Product_ID)>
  <cfoutput query="SecondLoad">
   <option value="#Product_ID#">* #ProductTitle#</option>
  </cfoutput>
 <cfelse>
   <option value="">Choose Fabric</option>
 </cfif>--->

<!--- main color selecter --->
<!--- check to see
  1. if only the description has been selected
  2. if the fabric has been selected
  3. first visit to form --->

 <cfif ParameterExists(form.Product_ID) AND form.Product_ID eq 0>
  <cfoutput>
   <option value="#ThirdSelectID#">#ThirdSelectMessage#</option>
  </cfoutput>
   </select>
 <cfelseif ParameterExists(form.Product_ID)>
  <cfoutput query="ThirdSelect">
      <option value="#Opt_ID#">#OptTitle#</option>
  </cfoutput>

   </select>
 <cfelse>
  <cfoutput>
   <option value="#ThirdSelectID#">#ThirdSelectMessage#</option>
  </cfoutput>
   </select>
 </cfif>





 </td>
</tr>

<tr>
 <td>





 </td>
</tr>






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to