Hi all! :-)

I'm trying to create a quote calculator for my website, and it need to be in drop-down-list format, where basically the user will select make>model>spec>transmission etc, and that's fine, i can do that using the usual drop down options in Dreamweaver CS3, add the numeric values to the list lables and calculate the total.

The problem i have is that is someone selects, for example, a Land Rover from the 'make' list, i need the other drop downs to populate with the spec, model etc for Land Rover. Now i might just be getting confused but i'm thinking all this need to be in a database, and obviously i need to pull variables accross from somewhere, but can i still have numeric values attached to the drop down options, and where would i put the calculations? Would it be better for a user to select all the options they want, then go to another page where the calculations are preformed and the get their quote, or can it all be done on one page?

I hope i've explained this ok, if not then take a look at Direct Line's insurance quote here: https://uk6.directline.com/insurance/motor/PLB92573848566674849202/yourdetails.do;jsessionid=28309448436e562a234e

It's the same sort of thing as i'm trying to create but mines a lot simpler (i hope!) :-s

Anyway, if anyone out there has any experiance with this sort of thing, or has some pointers for me and maybe a bit of code i could play with, i would be eternaly gratefull!!!

Many thanks in advance, hope someone can help :-)

8 Years
Discussion Span
Last Post by Loki421

Here's a shot of the sort of thing it will look like, but imagine the top box selects the vehicle manufacturer, like Honda, BMW etc, then the next one down populates with the models for that manufacturer, then when you select the model the next box populates with the spec for that model etc etc.

Attachments Untitled-1.jpg 63.23 KB

Ok, i may be making progress here, but i could do with knowing how to add an atribute to this code so that when i select a manufacturer, the next box populates with the right models.

<select name="make 2" id="make 2">
      <option value="--please select--">--please select--</option>
      <cfoutput query="rsManufacturer">
        <option value="#rsManufacturer.manufacturer#">#rsManufacturer.manufacturer#</option>

This is the first box obviously, but is there an action i could apply to it or something that would 'fetch' the next box?


Hi, sorry for the delay in repling, i've been away on a long deserved holiday :-D

Basically, i'm getting stuck here, i have this error report: see attached.

Here's the code so far, it's over two pages, here's the 'main' page:

<cfform name="quote" >
<table width="797">
<td width="84"><div align="right">Manufacturer:</div></td>
<td width="47">
<cfselect name="select_Manufacturer" bind="cfc:cf-select.get_Manufacturer()"
      display="manufacturer_ID" value="manufacturer_ID" BindOnLoad="true"/></td>
<td width="70"><div align="right">Model:</div></td>
<td width="41"><cfselect name="select_Model" bind="cfc:cf-select.get_Model({select_Manufacturer})"
      display="model_ID" value="model_ID"/></td>
<td width="60"><div align="right">Spec:</div></td>
<td width="41"><cfselect name="select_Spec" bind="cfc:cf-select.get_Spec({select_Model})"
      display="spec_ID" value="spec_ID"/></td>
<td width="90"><div align="right">Transmission:</div></td>
<td width="41"><cfselect name="select_Trans" bind="cfc:cf-select.get_Trans({select_Spec})"
      display="trans_ID" value="trans_ID"/></td>
<td width="180" nowrap="nowrap"><div align="right">Get a quote on this vehicle</div></td>
<td width="79"><input type="submit" value="Calcluate Cost" /></td>

<cfif IsDefined("form.select_manufacturer") >
<cfquery datasource="quote-system" name="manu_cost">
	SELECT cost 
	AS manu_cost 
	FROM manufacturer_table  
	WHERE manufacturer_id = "#form.select_manufacturer#"
<cfquery datasource="quote-system" name="model_cost">
	SELECT cost 
    AS model_cost 
    FROM model_table 
    WHERE model_id = "#form.select_model#" 
	AND sub_manufacturer_ID = "#form.select_manufacturer#"
<cfquery datasource="quote-system" name="spec_cost">
	SELECT cost 
    AS spec_cost 
    FROM spec_table 
    WHERE spec_ID = "#form.select_spec#"
	AND sub_model_ID = "#form.select_model#" 

#form.select_manufacturer# :#manu_cost.manu_cost# <br/>
#form.select_model# :  #model_cost.model_cost#:<br/>
#form.select_spec#: #spec_cost.spec_cost# <br/>


And here's the 'back' page:

<cfset DBSource = "quote-system">
<cffunction name="get_Manufacturer" access="remote" returnType="query">
	<cfquery name="get_Man" datasource="#DBSource#">
		 SELECT * FROM manufacturer_table
	<cfreturn get_Man>

<cffunction name="get_Model" access="remote" returnType="query">
	<cfargument name="manufacturerid" type="any" required="true">
	<cfif ARGUMENTS.manufacturerid eq "">
		<cfset ARGUMENTS.manufacturerid = "0">
	<cfquery name="get_Mod" datasource="#DBSource#">
		FROM model_table 
		WHERE sub_manufacturer_ID = "#ARGUMENTS.manufacturerid#"
	<cfreturn get_Mod>

<cffunction name="get_Spec" access="remote" returnType="query">
	<cfargument name="modelid" type="any" required="true">
	<cfif ARGUMENTS.modelid eq "">	
		<cfset ARGUMENTS.modelid = "0">
	<cfquery name="get_Sp" datasource="#DBSource#">
		FROM spec_table
		WHERE sub_model_ID = "#ARGUMENTS.modelid#"
		<cfreturn get_Sp>

<cffunction name="get_Trans" access="remote" returnType="query">
	<cfargument name="specid" type="any" required="true">
	<cfif ARGUMENTS.specid eq "">	
		<cfset ARGUMENTS.specid = "0">
	<cfquery name="get_Tr" datasource="#DBSource#">
		FROM trans_table
		WHERE sub_spec_ID = "#ARGUMENTS.specid#"
		<cfreturn get_Tr>

<cffunction name="get_Extra" access="remote" returnType="query">
	<cfargument name="transid" type="any" required="true">
	<cfif ARGUMENTS.transid eq "">	
		<cfset ARGUMENTS.transid = "0">
	<cfquery name="get_Ex" datasource="#DBSource#">
		FROM extras_table
		WHERE sub_trans_ID = "#ARGUMENTS.transid#"
		<cfreturn get_Ex>


So if anyone knows why this is tripping up at line 45 i would be very happy to hear your advice:-)

Many thanks in advance guys and gals :-p

Attachments Untitled-1.jpg 68.69 KB
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.