Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Hastings, East Sussex
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    selPackName1.0 is null or not an object

    I want to check to determine if my select list box is empty and return out the funciton if so. What happens is that when I execute the following code below I get:

    document.main_form.selPackName1.0 is null or not an object. Does anyone know of a way round this?

    if (document.main_form.selPackName1[0] == null)
    {
    return
    }

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    The problem exists because of the decimal point/full stop in the select name. If you change that like this:
    from:
    selPackName1.0
    to:
    selPackName1_0

    then change all the references to it, then your problem should be resolved

    hope this helps

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Hastings, East Sussex
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The decimal point exists only in the message that is displayed by the javascript error alert box, it does not exist in the name of the select box.

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Hastings, East Sussex
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've fixed this now it needed:

    if (typeof(document.main_form.selPackName2) == 'undefined')
    {
    return;
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •