Hi,

Good day!

I encountered error : 'undefined' is null or not an object when i type on my two textboxes :

Code:
echo "<label class='LLabel'> Material Barcode: </label>";
    echo "<input type='password' name='barcode' id='barcode' value='' onkeypress='get_data();' size='40' class='LField'>";
    echo "<br/><br/>";
    echo "<label class='LLabel'> Warehouse Barcode: </label>";
    echo "<input type='password' name='barcode_wh' id='barcode_wh' value='' onkeypress='get_wh()' size='40' class='LField'>";
here is my index.php
PHP Code:
<?php
    date_default_timezone_set
('Asia/Manila'); //set the time zone
    
include('includes/connection.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="javascript/wms.js"> </script>
<script type="text/javascript" src="javascript/prompt.js"> </script>
<script type="text/javascript" src="javascript/notification.js"> </script>

<link rel="stylesheet" type="text/css"  href="css/prompt.css">
<link rel="stylesheet" type="text/css"  href="css/notify.css">
<link rel="stylesheet" type="text/css"  href="css/wms.css">
<title>Warehouse Barcoding</title>
</head>
<body onLoad="document.getElementById('barcode').focus();">
<form name="wms" action="" method="post">
<?php
$dateEntry 
date("Y-m-d h:i:s");
    echo 
"<div>";
    echo 
"<label class='LLabel'>DateTime: </label>";
    echo 
"<input type='text' name='date_entry' id='date_entry' value='$dateEntry' onkeypress='get_data();' size='40' class='LField' style='border:none;'>";
    echo 
"<br/><br/>";
    echo 
"<label class='LLabel'> Material Barcode: </label>";
    echo 
"<input type='password' name='barcode' id='barcode' value='' onkeypress='get_data();' size='40' class='LField'>";
    echo 
"<br/><br/>";
    echo 
"<label class='LLabel'> Warehouse Barcode: </label>";
    echo 
"<input type='password' name='barcode_wh' id='barcode_wh' value='' onkeypress='get_wh()' size='40' class='LField'>";

    echo 
"</div>";
//$barcode = '10001CHE00102401100200250000.50';
    
echo "<div id='display_data'>";
    echo 
"<table>";
    echo 
"<tr>";
    echo 
"<th>PO Number</th>";
    echo 
"<th>Unique ID</th>";
    echo 
"<th>Kind</th>";
    echo 
"<th>Item Code</th>";
    echo 
"<th>Description</th>";
    echo 
"<th>UoM</th>";
    echo 
"<th>Supplier</th>";
    echo 
"<th>Quantity</th>";
    echo 
"</tr>";
    
    echo 
"<tr>";
    echo 
"<td><input type='text' name='po_number' id='po_number' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='unique_id' id='unique_id' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='kind' id='kind' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='material_code' id='material_code' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='description' id='description' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='uom' id='uom' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"<td><input type='text' name='supplier' id='supplier' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";    
    echo 
"<td><input type='text' name='qty' id='qty' value='' readonly='readonly' disabled='disabled' class='text_field'></td>";
    echo 
"</tr>";
    echo 
"</table>";    
    echo 
"</div>";    
    
    echo 
"<div id='display_wh'>";
    echo 
"<table>";
    echo 
"<tr>";
    echo 
"<th>Warehouse #</th>";
    echo 
"<th>Row #</th>";
    echo 
"<th>Rack #</th>";
    echo 
"<th>Level</th>";
    echo 
"</tr>";
    
    echo 
"<tr>";
    echo 
"<td><input type='text' name='whse' id='whse' value='' readonly='readonly' disabled='disabled' class='text_field_wh'></td>";
    echo 
"<td><input type='text' name='row' id='row' value='' readonly='readonly' disabled='disabled' class='text_field_wh'></td>";
    echo 
"<td><input type='text' name='rack' id='rack' value='' readonly='readonly' disabled='disabled' class='text_field_wh'></td>";
    echo 
"<td><input type='text' name='level' id='level' value='' readonly='readonly' disabled='disabled' class='text_field_wh'></td>";
    echo 
"</tr>";
    echo 
"</table>";    
    echo 
"</div>"
    
    echo 
"<input type='hidden' name='barcode_mat_data' id='barcode_mat_data' value=''>";
    echo 
"<input type='hidden' name='barcode_wh_data' id='barcode_wh_data' value=''>";
?>
</form>
</body>
</html>
and my wms.js
Code:
var loadingmessage = '<center>Getting material info ... <img src="images/loading.gif" /></center>';
function AJAX(){
    var xmlHttp;
    try{
        xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
        return xmlHttp;
        }
    catch (e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
            return xmlHttp;
            }
        catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                return xmlHttp;
                }
            catch (e){
                alert("Your browser does not support AJAX!");
                return false;
                }
            }
        }
    }
    
function notify(message) {
    if (document.getElementById('notice') !== null) {
        document.getElementsByTagName('body')[0].removeChild(document.getElementById('notice')) 
    }
    alerter('images/dunlop1.jpg','Warehouse Barcoding System',message);
}

function refresh(time){
 setTimeout("location.reload(true);",time);
 
}

//----barcode mat---//
function get_data(){
    if (window.event.keyCode==13 || window.event.keyCode==10) {
    var barcode_wms = document.getElementById("barcode").value;
    var divid = "display_data";
    var url = "getbarcode_data.php";
    var str = "mc=" + barcode_wms;
    var xmlHttp = AJAX();
    xmlHttp.onreadystatechange=function(){
   
    if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
  
            var jsonart = xmlHttp.responseText;
   
            if (jsonart.replace(/\s+/g, '') == "Invalid") {
 
               notify("Invalid Material Barcode");
             refresh(1500);
            }
            else
            {
              
            var strsplit = jsonart.split("^");
            document.getElementById("po_number").value = strsplit[0];
            document.getElementById("unique_id").value = strsplit[1];
            document.getElementById("kind").value = strsplit[2];
            document.getElementById("material_code").value = strsplit[3];
            document.getElementById("description").value = strsplit[4] ;
            document.getElementById("uom").value = strsplit[5] ;
            document.getElementById("supplier").value = strsplit[6] ;           
            document.getElementById("qty").value = strsplit[7] ;
            document.getElementById("barcode_mat_data").value = strsplit[8] ;

            document.getElementById('barcode').disabled = true;

             document.getElementById('barcode_wh').value = '';
             document.getElementById('barcode_wh').focus();
            
            
            }
            }
    }
    }
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", str.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(str);
}



//----barcode warehouse---//
function get_wh(){
    if (window.event.keyCode==13 || window.event.keyCode==10) {
    var barcode_wh = document.getElementById("barcode_wh").value;
    var divid = "display_wh";
    var url = "getbarcode_wms.php";
    var str = "wh=" + barcode_wh;
    var xmlHttp = AJAX();

    xmlHttp.onreadystatechange=function(){  
    if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var jsonart = xmlHttp.responseText;

            if (jsonart.replace(/\s+/g, '') == "Invalid") {
    
               notify("Invalid Warehouse Barcode");
   
             
                document.getElementById('barcode_wh').value = '';
                document.getElementById('barcode_wh').focus();

                return false;  
            }
            else
            {
              var strsplit = jsonart.split("^");
             document.getElementById("whse").value = strsplit[0];
            document.getElementById("row").value = strsplit[1];
            document.getElementById("rack").value = strsplit[2];
            document.getElementById("level").value = strsplit[3];
            document.getElementById("barcode_wh_data").value = strsplit[4] ;
            
            document.getElementById('barcode_wh').disabled = true;
            
            save();
            
            
            }
            }
    }
    }
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", str.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(str);

}
I can't find what is the cause of that error when i type on Material Barcode also in Warehouse Barcode.

I hope somebody can help me to resolve this error.

Thank you so much.