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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass drop down value use javascript

Status
Not open for further replies.

eva0212

Programmer
Jun 30, 2008
8
Here have an question on passing values using javascript. Below is javascript function. document.all("site_pkid").value; is a drop down list that select data from databse. An the other value is just input text field.I get an Error: document.all("site_pkid") is undefined
while running this use mozilla firefox and cannot be function. But this can function in IE. Then what can i do to solve that can running this code in Mozilla and IE without error?


Code:
<select name="site_pkid" onChange="getSite(this.value)">
    <option value="0"></option>    
    <?
$querySite = "SELECT pkid, site_name FROM " . $table['site'] . " WHERE status = 1";
$resultsSite = $database->query($querySite);
while($results_site = $resultsSite->fetchRow()) {    
    
    $querySubStores = "SELECT pkid FROM " . $table['material_types_details'] . " WHERE site_pkid = 
".$results_site['pkid'];
    $resultsSubStores = $database->query($querySubStores);
    $num_subStores = $resultsSubStores->numRows();
    
    if($num_subStores > 0)    {
?>        
        <option value="<?=$results_site['pkid']?>"
<?if($results_site['pkid'] == $location) echo " selected";?>>
<?=$results_site['site_name']?></option>
<?    }}    ?>


Code:
function transferTo(theMaterial)
{
    var theSites = document.all("site_pkid").value;
    var theMaxLevel = document.all("max_level").value;
    var theMinLevel = document.all("min_level").value;
    var theStandardPrice = document.all("standard_price").value;
    var theBinNo = document.all("binNo_id").value;    
    var theReorderLevel = document.all("reorder_level").value;
    var theReorderQuantity = document.all("reorder_quantity").value;
    var theLead_time = document.all("lead_time").value;
    var theSubStore = document.all("subStore_id").value;

    
window.location.href='sub_Store.php?pkid=<?=$pkid?>&tab=<?=$tab?>&
site_pkid='+theSites+'&max_level='+theMaxLevel+'&min_level='+theMinLevel+'&
standard_price='+theStandardPrice+'&binNo_id='+theBinNo+'&
reorder_level='+theReorderLevel+'&reorder_quantity='+theReorderQuantity+'&
lead_time='+theLead_time+'&subStore_id='+theSubStore+'&actionPg=add';    
}


Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top