"empid" is undefined or null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manojsingh
    New Member
    • Jun 2007
    • 11

    "empid" is undefined or null

    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.disab led=false;
    document.form1. updatebutton.di sabled=true;
    document.form1. deletebutton.di sabled=true;
    empid.style.dis play='block';
    cmb.style.displ ay='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="updat eDeleteRecord() ;">
    <%
    ArrayList empArr = (ArrayList) session.getAttr ibute("fetchEmp Id");
    Iterator it=empArr.itera tor();
    while (it.hasNext())
    {
    String empidStr=(Strin g)it.next();
    %>
    <option value=<%=empidS tr%>><%=empidSt r%></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
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    You are getting an error about a css id, it's still a javascript error. I'm sending you there.

    Comment

    • iam_clint
      Recognized Expert Top Contributor
      • Jul 2006
      • 1207

      #3
      [CODE=javascript]
      empid.style.dis play='block';
      cmb.style.displ ay='none';
      [/CODE]

      its because these two items are not defined anywhere.

      do this
      [CODE=javascript]
      document.getEle mentById("empid ").style.displa y='block';
      document.getEle mentById("cmb") .style.display= 'none';
      [/CODE]

      Comment

      Working...