PDA

View Full Version : <select> drop down and window.location



vineet
06-17-2009, 12:21 PM
hi all

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



var dealerid;
function getList(xyz)
{
window.location='manage_products.php?category_id=' + xyz;
}
function getProducts(dealer_id)
{
var catid=document.form1.category.value;
window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid ;
}


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



<select name="sub_catg" onchange="getSb(this.value)" id="sub_catg">
<option>Select Sub Category</option>
<option value="Batteries">Batteries</option>
<option value="Leather & PU Cases">Leather &amp; PU Cases</option>
<option value="Crystal & Rubber Coated Cases">Crystal &amp; Rubber Coated Cases</option>
<option value="Car Mounts & USB Cradles">Car Mounts &amp; USB Cradles</option>
<option value="AC Chargers & Car Chargers">AC Chargers &amp; Car Chargers</option>
</select>


This is function that is not working


<script language="javascript">
var subid=document.form1.sub_catg.value;
function getSb(subid)
{
window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid + "&sub_catg=" + subid ;
}
</script>


vineet

Jesdisciple
06-20-2009, 05:54 PM
dealer_id and catid are undefined.... Look at what the second function you posted does to solve this and do it for both fields.