Problem With an Undefined Variable

Giganews Newsgroups
Subject: Problem With an Undefined Variable
Posted by:  wolverine16… (Mike)
Date: 28 Jul 2003

I am having a problem when a field is spaces being undefined. I wasn't
sure if the problem was Excel or Javascript, so I thought I would post
here first.

The users are able to select from a drop down list either a
pre-existing Excel spreadsheet or a blank spreadsheet where they can
enter the data. When they click the Store button I am using Javascript
to validate the fields. If a particular field is not entered or has
invalid data, then an error message will appear on the screen. In this
case, I was testing for a blank field and did not get the error
message I was expecting. So I put in some Response.Write statements to
display what was in the field and in this case is where it came back
as undefined. If there is data in the field, then the field displays
correctly. The following is an example of the code:

  while (mExcelApp.ActiveSheet.Cells(indexRow, 1) != "RECORD");
  RecordCount = 0;


    var xlSourceDoc = mExcelApp.ActiveSheet.Cells(indexRow, 2);
    var xlRefNumber = mExcelApp.ActiveSheet.Cells(indexRow, 3);
    var xlFYR = mExcelApp.ActiveSheet.Cells(indexRow, 4);
    var xlClass = mExcelApp.ActiveSheet.Cells(indexRow, 5);
    var xlNNNNN = mExcelApp.ActiveSheet.Cells(indexRow, 6);
    var xlAAAA = mExcelApp.ActiveSheet.Cells(indexRow, 7);
    var xlLLLL = mExcelApp.ActiveSheet.Cells(indexRow, 8);
    var xlFFF = mExcelApp.ActiveSheet.Cells(indexRow, 9);
    var xlLineDollarAmt = mExcelApp.ActiveSheet.Cells(indexRow, 10);
    var xlLineUnits = mExcelApp.ActiveSheet.Cells(indexRow, 11);
    var xlLineDesc = mExcelApp.ActiveSheet.Cells(indexRow, 12);

    if ((xlSourceDoc == "") || (xlSourceDoc == null) || (xlSourceDoc
== "undefined"))
      mError = 11;
      mResults = showErrorMsg();
  while (RecordCount < xlRecCnt);

In showErrorMsg() is where I have my error messages and mError = 11
returns a particular message.

Being fairly new to both Excel and Javascript, I am at a lost as to
how to correct the problem. Does anyone have an idea what I need to
do? TIA for any help!