Connecting Tech Pros Worldwide Forums | Help | Site Map

"empid" is undefined or null

Newbie
 
Join Date: Jun 2007
Posts: 11
#1: Jun 4 '07
hi,

I am developing on a Payroll system and using Jsp/servlet technology. For this I have created a Employee Information Page which has three buttons Add Employee Information , Modifiy Employee Information and Delete Employee Information.

There is a JavaScript function which executes on BODY tag's onload function.
// -- <body onload="funAdd()" --//

function funAdd()
{


document.form1.addbutton.disabled=false;
document.form1.updatebutton.disabled=true;
document.form1.deletebutton.disabled=true;
empid.style.display='block';
cmb.style.display='none';
}

As you can see that on body load the rest two buttons should be disabled.

Again I have two more contorl in the form one TextField and one Combo. And I am using stylesheet to hide the combo using its id,which is cmb. Same thing happen when I am slecting update button, it calls a function funUpdate and hide the textbox and displays combo with al the employee id present in my database.

the code is

<div id="empid" style="display:block"> <input name="txtempid" type="text"></div>

//-- you can see the code written belwo populating data from JSP session --//

<div id="cmb" style="display:none">
<select name="select" id="selectValue" onChange="updateDeleteRecord();">
<%
ArrayList empArr = (ArrayList) session.getAttribute("fetchEmpId");
Iterator it=empArr.iterator();
while (it.hasNext())
{
String empidStr=(String)it.next();
%>
<option value=<%=empidStr%>><%=empidStr%></option>
<%
}
%>
</select>
</div>

Now the problem when I running this application in my home PC it runs very well but when I install this in our client machine, only 25% page displays and a javascript message comes in status bar -- empid is undefined or not an object.

What I did, removed all javascript and then added one by one. then again the page executed.

Now again I taken this modified page to other machine it started giveing same again...

Page stops exactly two line before the Jsp code...(which is fetching data form session)

I am frusted and searching on google from two days .... as I dont understand any problem here so i am also not able to find out the problem

Client is using IE 6.0

Please help me, what should I do...

If I am not clear then Please write, I will try to explain in more detail

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,566
#2: Jun 4 '07

re: "empid" is undefined or null


You are getting an error about a css id, it's still a javascript error. I'm sending you there.
iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#3: Jun 4 '07

re: "empid" is undefined or null


Expand|Select|Wrap|Line Numbers
  1. empid.style.display='block';
  2. cmb.style.display='none';
  3.  
its because these two items are not defined anywhere.

do this
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("empid").style.display='block';
  2. document.getElementById("cmb").style.display='none';
  3.  
Reply