We help IT Professionals succeed at work.

Run time error from JS function

adspmo
adspmo asked
on
245 Views
Last Modified: 2013-12-18
Hi Guys

I am getting a run time error

Error:document.all.logDateEstBetaComp is null or not an object
I believe it is coming from this function

I have added
 fields[fields.length] = new Array("DateEstBetaComp", "ESTIMATED BETA COMPLETION")
 fields[fields.length] = new Array("DateActBetaComp", "ACTUAL BETA COMPLETION")


function LogAndSave()
{
      var fields = new Array()

      if (document.all.IsNewDoc.value == "YES")
      {
            document.all.logRequestStatus.value = "STATUS:[BLANK]->" + document.all.RequestStatus.value
            document.all.logPriority.value = "PRIORITY INDEX:[BLANK]->" + document.all.Priority.value
      }
      else
      {
            fields[fields.length] = new Array("RequestStatus", "STATUS")
            fields[fields.length] = new Array("Priority", "PRIORITY INDEX")
      }

      fields[fields.length] = new Array("DateValidThru", "PROPOSAL VALID THRU")
      fields[fields.length] = new Array("DateScheduledStart", "SCHEDULED START")
      fields[fields.length] = new Array("DateCommittedDelivery", "COMMITTED DELIVERY")
      fields[fields.length] = new Array("DateActualDelivery", "ACTUAL DELIVERY")
                fields[fields.length] = new Array("DateEstBetaComp", "ESTIMATED BETA COMPLETION")
                fields[fields.length] = new Array("DateActBetaComp", "ACTUAL BETA COMPLETION")
      fields[fields.length] = new Array("Effort", "EFFORT (FORECAST)")
      fields[fields.length] = new Array("EffortActual", "EFFORT (ACTUAL)")
      fields[fields.length] = new Array("Requestor", "REQUESTOR")

      for ( i=0; i<fields.length; i++ )
      {
            oldVal = eval( 'defaultValues["' + fields[i][0] + '"]' )

            if ( eval( 'document.all.' + fields[i][0] +'.tagName' ) == "SELECT" )                  
                  try { currVal = eval('document.all.' + fields[i][0] +'.options[document.all.' + fields[i][0] + '.selectedIndex].text' ) } catch(ex) { currVal = eval('document.all.' + fields[i][0] +'.value' ) }
            else
                  currVal = eval('document.all.' + fields[i][0] +'.value' )

            if ( oldVal == undefined || currVal == undefined ) continue

            if ( eval('document.all.' + fields[i][0] +'.fieldType' ) == "uad" )
                  if ( oldVal.match( /(\d{2})\/(\d{2})\/(\d{4})/ ) )
                        oldVal = eval( dateUad )

            if ( ( oldVal != currVal ) || ( oldVal == "Hold" && currVal == "Hold"  ) )
            {
                  if ( oldVal == "" ) oldVal = "[BLANK]"
                  if ( currVal == "" ) currVal = "[BLANK]"
                  eval( 'document.all.log' + fields[i][0] + '.value = "' + fields[i][1] + ':' + oldVal + '->' + currVal + '"' )
            }
      }

      document.forms[0].submit();
}

var leftRef = 60
Comment
Watch Question

Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Hi adspmo,

What's with the Debugger? Doesn't it work? :)

Cheers!
    Sjef

Author

Commented:
Still learning how to use it

This error popped up ,when I went in to debugger there was nothing showing
Groupware Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
adspmo,

Just saw in your code the try..catch statement. This is JS1.4, so older browsers won't understand it. You could try to use this construction for your other problem, with the Date.parse(). If it fails, there is no correct date.

Sjef

Commented:
Sjef
I believe venkman is only for Mozilla...not sure whether it can be used for I.E

Partha

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.