SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript Error - Populating Lists on the Fly

    Greetings, I'm no JavaScript expert, and we're having an issue resolving this problem. The issue does NOT happen in FireFox, but it happens in IE 7.0.

    When you select a state, then a city, then click search. You get results. On the results page, the search box appaers again. However, this time, the "city" drop-down doesn't work. You must reload the page to do another search.

    http://72.34.44.152/~arabdet/food.php

    You will only see the issue in IE 7.0. It will give you a JavaScript error on the page after the first search.

    Your help would be greatly appreciated.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by matar84 View Post
    Greetings, I'm no JavaScript expert, and we're having an issue resolving this problem. The issue does NOT happen in FireFox, but it happens in IE 7.0.

    When you select a state, then a city, then click search. You get results. On the results page, the search box appaers again. However, this time, the "city" drop-down doesn't work. You must reload the page to do another search.

    http://72.34.44.152/~arabdet/food.php

    You will only see the issue in IE 7.0. It will give you a JavaScript error on the page after the first search.

    Your help would be greatly appreciated.
    The error which shows up in Opera also, is

    message: Statement on line 21: Could not convert undefined or null to object
    Backtrace:
    Line 21 of linked script http://72.34.44.152/~arabdet/chain.js
    (document.getElementById("city")).options.length = 0;

    So it seems to be having trouble resolving that element. In I.E. document.getElementById returns a reference if an element with a matching name attribute is found as well as Id, and in your document you have a hidden type element also named 'city'. I suspect that this element is being found first. To eliminate this possibility, I suggest that you rename the hidden element (and any references to it).
    Tab-indentation is a crime against humanity.


Bookmarks

Posting Permissions

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