Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference a Field within a Selected Record

Status
Not open for further replies.

ReikoShea

Programmer
Mar 6, 2005
3
0
0
US
Alright what im trying to do is create a site for selling computer (Sort of like Dell).

I have my database including product IDs, but i am having problems verifying if components are compatable.

I have each Motherboard, CPU, Harddrive, etc. in a drop down list, and the values are set by the product id of each item.

Is there a way that i can access the other fields of that selected item.

E.g.:

The customer selects the Abit IC7-G MaxII ADVANCE, ProductID 13127152. I want the ProductID submitted to my customer Database, but i also want the properties of the each motherboard checked.

That motherboard is a Socket 478 motherboard with an AGP slot, and it will only accept DDR memory.

I want those 3 features to designated values as well so that I can check it against the processor, the graphics card, and the RAM selected by the use.

I thought about using a JavaScript array, and then i tried using an OR (||) statement, but it just is not working the way i want.

If anyone has any ideas i would love to hear them.
 
pretend we don't know a thing about computer components

could you show us the html for the dropdown list?

what does "access the other fields of that selected item" mean?

and how does the selected item relate to the database table?

could you show us the table layout too please?

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts March 6 2005)
 
if you do it the way dell does it will tell you "there is a configuration issue" after you click "continue" when you try to make a purchase that isn't compatible. It does the check on the server side, not javascript.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
what you *could* do is make it like a wizard. start with a componant like "mobo". once they select one they click an option like "Video". only show cards that are compatible with the mobo they selected. "agp/pci/pcie" If they click "RAM" only provide the options that fit with that mobo.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
I do appoligize for the fact that i could not reply earlier, and i do appreciate all the suggestions.

Verison is probably the WORST ISP I have ever had, but no worries, COMCAST IN 2 WEEKS YAY!!!

ANYWAY.

Alright here is what i have.


For the dropdown lists:
Code:
      <td>Motherboard</td>
      <td> <select name="mobo" id="mobo" onChange="updateForm()">
          <cfoutput query="mobo"> 
            <option value="#MoboSocket#" onChange="updateForm()">#MoboMaker# 
            #MoboName#</option>
          </cfoutput> </select></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td>CPU </td>
      <td> <select name="cpu" id="cpu" onChange="updateForm()">
          <cfoutput query="cpu"> 
            <option value="#CPUProductID#" onChange="updateForm()">#CPUMaker# 
            #CPUType# #CPUName#</option>
          </cfoutput> </select></td>

After the customer selects what motherboard he wants, i need the site to access ALL the information for that record in my database.
Escentially when he selects Abit IC7-G MaxII ADVANCE my website now has access to the following variables:

ProductID, CPUSocket, NorthBridge, SouthBridge, Available Frontside Bus, Available PCI, Available Graphics Slot, RAM Type, Available IDE, Price, etc.

but i do not know how to do it.

here is my JavaScript
Code:
<script language="JavaScript">
// JavaScript Document
<!--
function updateForm(){
var CPUSocket = window.document.forms[0].elements['cpu'].value;
var MOBOSocket = window.document.forms[0].elements['mobo'].value;
if ((CPUSocket = 19112173) || (CPUSocket = 19116164) || (CPUSocket = 19116171) || (CPUSocket = 19116173) || (CPUSocket = 19116180) || (CPUSocket = 19116178) || (CPUSocket = 19116193) || (CPUSocket = 19112188) || (CPUSocket = 19116187) || (CPUSocket = 19116172) || (CPUSocket = 19112172) || (CPUSocket = 19116166) || (CPUSocket = 19112176) || (CPUSocket = 19112196) || (CPUSocket = 19112190) || (CPUSocket = 19112194) || (CPUSocket = 19112188) || (CPUSocket = 19112192) || (CPUSocket = 19112195) || (CPUSocket = 19112191) || (CPUSocket = 19112193) || (CPUSocket = 19112186) || (CPUSocket = 19112200) || (CPUSocket = 19116141))
	{
	CPU1 = 478;
	}
else if ((CPUSocket = 19116185) || (CPUSocket = 19116200) || (CPUSocket = 19116201) || (CPUSocket = 19116198) || (CPUSocket = 19116182) || (CPUSocket = 19116197) || (CPUSocket = 19116196) || (CPUSocket = 19116191) || (CPUSocket = 19116190) || (CPUSocket = 19116189) || (CPUSocket = 19116195))
	{
	CPU1 = 775;
	}
else if (CPU1 != MOBOSocket)
	{
	alert ("Your Motherboard and CPU are incompatable");
	}
else if (CPU1 == MOBOSocket)
	{
	alert ("Congratulations");
	}
}
-->
</script>

and then here is a picture of the layout of my table.
LINK

I dont know whats up with my javascript...im pretty new at the advanced end of webdevelopment, but any suggestions would be GREATLY APPRECIATED.
 
sounds like you're looking for related selects or related dropdowns

try either of those phrases in a search engine along with the keyword ColdFusion

the techniques basically fall into two categories -- making a choice in one select sends a request to the server, and then the page comes back with the appropriate values in the second select filled in, or sending all possible values in the second select on the initial request of the page, and using javascript to detect the change in the first select and populate the values shown in the second

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts March 6 2005)
 
I would personally use the

making a choice in one select sends a request to the server, and then the page comes back with the appropriate values in the second select filled in
method.

loading EVERY option into the page and relying on JS to do the sorting is a bad idea. JS could be turned off and a user could order anything they wanted reguardless of compatability. Any thing essential like this should be handled by the server to avoid client side problems. Not to mention that would be a hugely bloated JavaScript that could take CF quite some time to generate...

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
I do appreciate the help, but saddly it is monday and my actual job is going to take up my time. Thank you both for your suggestions. I am quite sure they well help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top