I have been struggling from a long time to accomplish dependable select boxes in my php page. I have a select box say s1, which, on change should effect a few other select boxes say s2, s3, s4 to change options (ofcourse based on the value of s1).
What i did is - i wrote a JS function to get the value selected from s1 and i'm calling this JS function from onchage event in s1 like:
Code: Select all
<td><b>Partner:</b>
<select name="partnername" onChange = 'Get_Selected_Item(document.serverform.partnername);'>
<?php
populatelist('vendor_id','servermodeltable', 'DELL');
?>
</select>
</td>Code: Select all
<script = "javascript">
function Get_Selected_Item(obj)
{
alert('In the JS Function');
len = obj.options.length;
i = 0;
$chosen = "none";
for (i = 0; i < len; i++)
{
if (obj.options[i].selected)
{
$chosen = obj.options[i].value;
}
}
window.location.reload();
return $chosen;
}
</script>- Vamz