By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

<select> drop down and window.location

P: 41
hi all

i have two dynamic drop downs of dealer id and category id which work properly with window.location

Expand|Select|Wrap|Line Numbers
  1. var dealerid;
  2. function getList(xyz)
  3. {
  4. window.location='manage_products.php?category_id=' + xyz;
  5. }
  6. function getProducts(dealer_id)
  7. {
  8. var catid=document.form1.category.value;
  9. window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid ;
  10. }
  11.  
but now i want to add static drop down of sub category and make use of window.location which i m not able to do

Expand|Select|Wrap|Line Numbers
  1. <select name="sub_catg" onchange="getSb(this.value)"  id="sub_catg">
  2. <option>Select Sub Category</option>
  3. <option value="Batteries">Batteries</option>
  4. <option value="Leather & PU Cases">Leather &amp; PU Cases</option>
  5. <option value="Crystal & Rubber Coated Cases">Crystal &amp; Rubber Coated Cases</option>
  6. <option value="Car Mounts & USB Cradles">Car Mounts &amp; USB Cradles</option>
  7. <option value="AC Chargers & Car Chargers">AC Chargers &amp; Car Chargers</option>
  8. </select>
  9.  
This is function that is not working
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. var subid=document.form1.sub_catg.value;
  3. function getSb(subid)
  4. {
  5. window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid + "&sub_catg=" + subid ;
  6. }
  7. </script>
  8.  
vineet
Jun 17 '09 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
See how you set catid in getProducts()? You need to do the same thing for catid and dealer_id in getSb() too.

Also, there's no need for the subid line - in fact, it would probably result in a error.
Jun 17 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.