>- see footer for list info -<
As you did not specify where the error was occuring, I will guess that it is
maybe

WHERE     (tblJoinMakeAndModel.MakeIDFK = #page.select_Main_Group#)


If your second query is based on the value of the first select list that is
submitted then surely it should be

WHERE     (tblJoinMakeAndModel.MakeIDFK = #form.select_make#) 

Russ
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Swingewood
Sent: 02 July 2006 22:12
To: [email protected]
Subject: [CF-Dev] Chained selects

>- see footer for list info -<
Can anyone see whats wrong with this please ...?

I have three tables .... Make, Model, and JoinmakeModel

Make has ford etc... Model has mondeo etc.... Join just lists which models
are for which makes ...

The Code......

<!--- store the selected Main_Group variable variable after the first select
boxes submits itself ---> <cfif isDefined('form.select_make')>
    <cfset page.select_make = form.select_make> </cfif>

<cfoutput>
  <form name="DropDown" method="post">
  <!--- query DB for the first drop down list --->
  <!--- Get The Makes --->
                        <cfquery name="getMakes"
datasource="#application.DSN#">
                                SELECT MakeIDPK, Make
                                FROM tblMakes
                                ORDER BY Make ASC
                        </cfquery>


  <!--- first drop down list --->
  <!--- NOTICE the onChange javascript event in the select tag, this is what
submits the form after the first selection --->
  <select name="select_make" required="yes" onchange="this.form.submit()">
     <option>Make</option>
     <!--- dynamically populate the first drop down list based on the
getMakes query --->
     <!--- NOTICE the CFIF within the option tag, this says, if the first
selection has been made, display the chosen option when the page reloads 
--->
     <cfloop query="getMakes">
         <option value='#MakeIDPK#'
                                        <cfif isDefined('form.select_make')>
                                                <cfif form.select_make eq
#MakeIDPK#>selected
                                                </cfif>
                                        </cfif>>#Make#</option>
     </cfloop>
</select>
<p>

<cfoutput>#page.select_Main_Group#</cfoutput><cfabort>


<!--- if the first selection has been made, display the second drop down
list with the appropriate results --->

   <!--- query DB for second drop down list, based on the selected item from
the first list --->
   <cfquery name="getModel" datasource="#application.DSN#">
        SELECT tblJoinMakeAndModel.MakeIDFK,
                                        tblModels.Model
                                FROM tblMakes
                                INNER JOIN tblJoinMakeAndModel ON
tblMakes.MakeIDPK = tblJoinMakeAndModel.MakeIDFK
                                INNER JOIN tblModels ON
tblJoinMakeAndModel.ModelIDFK = tblModels.ModelIDPK
                                WHERE     (tblJoinMakeAndModel.MakeIDFK =
#page.select_Main_Group#)
                        </cfquery>

   <!--- second drop down list --->
   <select name="select_model" required="yes">
      <option>Select Model</option>
      <!--- dynamically populate the second drop down list based on the
get_model query --->
      <cfloop query="getModel">
         <option value="#ModelIDPK#">#Model#</option>
      </cfloop>
   </select>


</form>
</cfoutput>

I based it on the Ryan M BeMiller example.....

I keep getting this ....

You have attempted to dereference a scalar variable of type class 
java.lang.String as a structure with members.

Regards - Paul


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to