Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Double Drop Down Menu Problem
Old 08-06-2007, 12:34 PM Double Drop Down Menu Problem
Junior Talker

Posts: 1
Name: cara
Trades: 0
hi everyone i was hoping someone could give me a quick hand.
i use zen cart and im trying to add a double drop down menu to a sidebox. but the categories and sub cats are not populating. the drop down works fine on my computer i can choose the cat and the sub cats will open, but once uploaded to my site it doesn't work. this is how this drop down works when you click on the categories it opens the sub cats for that category. and when you click on a sub cat it will bring you to that page. now i noticed in the php code below it says

<FORM name="drop_list" action="yourpage.php" method="POST" >
what would i put for the action="yourpage.php" since i want the page to change for each subcat?
maybe im going about this all wrong.

here is all the code.

This is the actuall sidebox code for the page

PHP Code:
<?php
//
// Blank Sidebox Mod
// includes/templates/templates_default/sideboxes/tpl_blank_sidebox.php
//
//  --------------------------------------------------
//  http://www.MommaMuse.com mod Zen-Cart - by Judi Cox                  
//  --------------------------------------------------
//  zen-cart Open Source E-commerce                                      
//  Copyright (c) 2003-2006 The zen-cart developers                           
//  http://www.zen-cart.com/index.php                                    
//  Portions Copyright (c) 2003 osCommerce                               
//  --------------------------------------------------
//  This source file is subject to version 2.0 of the GPL license,       
//  that is bundled with this package in the file LICENSE, and is        
//  available through the world-wide-web at the following url:           
//  http://www.zen-cart.com/license/2_0.txt.                             
//  If you did not receive a copy of the zen-cart license and are unable 
//  to obtain it through the world-wide-web, please send a note to       
//  license@zen-cart.com so we can mail you a copy immediately.
//  --------------------------------------------------
//
// $Id: tpl_blank_sidebox.php,v 1.0 6/24/2006
// Original modification by Carter Harris charris@technettn.net based on the tpl_featured.php file 
// Additionally modified by Judi Cox http://www.mommamuse.com
  
$content '';
  
$content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';
  
$content .= '
 
<html>
<head>
<title>Ailments List</title>
<script language="javascript" src="http://www.tonoend.com/list.js"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onload="fillCategory();">
<FORM name="drop_list" action="yourpage.php" method="POST" >
 
<SELECT  NAME="Category" onChange="SelectSubCat();" >
<Option value="">Ailment</option>
</SELECT>&nbsp;<br>
<SELECT id="SubCat" NAME="SubCat" onchange="location.href=this.value">
<Option value="">Cure</option>
</SELECT>
</form>
</body>
</html>
'
;
  
$content .= '</div>';
?>
and this is the js file it calls

Code:
function fillCategory(){ 
// this function is used to fill the category list on load
addOption(document.drop_list.Category, "Abdominal","Abdominal", "");
addOption(document.drop_list.Category, "Abrasions","Abrasions", "");
addOption(document.drop_list.Category, "Abscess","Abscess", "");
addOption(document.drop_list.Category, "Acidity","Acidity", "");
addOption(document.drop_list.Category, "Acne Remedy","Acne Remedy", "");
addOption(document.drop_list.Category, "Yeast Infection","Yeast Infection", "");
}
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "SubCat", "");
if(document.drop_list.Category.value == 'Fruits'){
addOption(document.drop_list.SubCat,"http://www.gothenaturalway.com", "Mango");
addOption(document.drop_list.SubCat,"Banana", "Banana");
addOption(document.drop_list.SubCat,"Orange", "Orange");
}
if(document.drop_list.Category.value == 'Games'){
addOption(document.drop_list.SubCat,"Cricket", "Cricket");
addOption(document.drop_list.SubCat,"Football", "Football");
addOption(document.drop_list.SubCat,"Polo", "Polo", "");
}
if(document.drop_list.Category.value == 'Scripts'){
addOption(document.drop_list.SubCat,"PHP", "PHP");
addOption(document.drop_list.SubCat,"ASP", "ASP");
addOption(document.drop_list.SubCat,"Perl", "Perl");
}
}
////////////////// 
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
 
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
i removed alot of the categories as there were so many and i didnt want to take up alot of space. also the subcats are not done and do not match the cats yet. but it should all work just the same.
i uploaded the list.js file right to the main directory

here is the page where i have it so you can see what is happeneing.

http://www.gothenaturalway.com


thanks so much in advance for any help anyone can offer.

Cara
punkkittyy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Double Drop Down Menu Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08680 seconds with 12 queries