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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem populating select list

    Hello,

    I run my own advertising website which allows people to create adverts for different types of pets. I have 2 select lists, when selecting an option in the 1st list (pet Tye) it populates the second list (pet Breeds) with the options defined in an array.

    This has always worked fine for me and most of my users, but over the past month or 2, I am getting more and more people contacting me saying that when they select an option from the 1st list it doesnt populate the second, or the second list is just blue.

    The page can be found at http://www.pets4homes.co.uk/pets4hom...dvert?OpenForm
    and you will need to log in using the username of 'testuser' and password of 'password'.

    The first field is pet type and the second is pet breed. Like I mentioned I cant find anything wrong as it always works for me. I dont think its a problem with javascript being enabled on their browser, because if they press the submit button at the bottom of the page, it still does the javascript field validation.

    Please could someone have a look and give me some advice??

    Many Thanks for your time
    Mark

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by pets4homes View Post
    Hello,

    over the past month or 2, I am getting more and more people contacting me saying that when they select an option from the 1st list it doesnt populate the second, or the second list is just blue.
    It would be helpful to know the browser/platform combination(s) with the problem.

    In the function updateCategories, it may improve reliability to change
    Code:
    document.forms[0].BreedTX[0].text = "All Pet Breeds";
    
    /* and */
    
    document.forms[0].BreedTX[i+1].text = keywordArray[ kwd ][ i ];
    to
    Code:
    document.forms[0].BreedTX.options[0] = new Option("All Pet Breeds");
    
    /* and */
    
    document.forms[0].BreedTX.options[i+1] = new Option(keywordArray[ kwd ][ i ]);
    Also I see no need to preset the length of the select before populating it.

    Another bug I noticed is a script error when "Select a Pet Type" is re-selected, because the code is testing instead for "All Pet Types". It would be better to test for a selectedIndex of 0.

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that, I've made the changes to my javascript function and it seems to be working fine still for me.

    People are still reporting the same problem though, they are saying they cannot select a breed or the breed field is blue and empty. Anyone seen anything similar with select fields?

    Cheers
    Mark

  • #4
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by pets4homes View Post
    Thanks for that, I've made the changes to my javascript function and it seems to be working fine still for me.

    People are still reporting the same problem though, they are saying they cannot select a breed or the breed field is blue and empty.
    You still haven't stated what they're using. If they're communicating via your contact form, I suggest you have it record the UA string, which usually will give you a good idea of the browser and platform.

    This should do it if you insert it within the form:
    Code:
    <SCRIPT type='text/javascript'>
     document.write("<INPUT TYPE='hidden' NAME='UA:'  VALUE='" +navigator.userAgent+ "'>");
    </SCRIPT>
    Looking at the code again there are a few matters of good practice that I would address, even though they may have no effect.

    I notice that General.js is dependent upon AllPetTypes.js yet it is loaded first. Although in practice this shouldn't be a problem, I would reverse their loading order. Also I would change the absolute addressing you're using to load code files, to relative addressing.

    The use of the JavaScript pseudo protcol ( javascript: ) is not needed to call functions in event handlers, and I would delete it.
    Last edited by Arty Effem; 10-17-2006 at 04:04 AM.

  • #5
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for replying again. I have just spoke to one user who is getting the problem and he is using microsoft IE. The select field is turning blue when he selects a pet type.

    I have only just started using absolute URL for JS files, i thought the relative ones may have caused problems.

    I also asked him to send me the source of the page when he does a view source and noticed the following differences from mine:

    My viewsource top lines :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Welcome to the Pets4Home Website</title><base href="http://www.pets4homes.co.uk/pets4homes/home.nsf/">
    <script src="http://www.pets4homes.co.uk/pets4homes/home.nsf/General.js" type="text/javascript"></script>
    <script src="http://www.pets4homes.co.uk/pets4homes/home.nsf/AllPetTypes.js" type="text/javascript"></script>
    <script src="http://onlinecount.com/onnow.php?site=ss02645" language="javascript" type="text/javascript"></script>
    <LINK REL="stylesheet" TYPE="text/css" HREF="tabbed.css">



    His viewsource top lines :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Welcome to the Pets4Home Website</title><base href="http://www.pets4homes.co.uk/pets4homes/home.nsf/">

    <script language="JavaScript">
    <!--

    function SymError()
    {
    return true;
    }

    window.onerror = SymError;

    var SymRealWinOpen = window.open;

    function SymWinOpen(url, name, attributes)
    {
    return (new Object());
    }

    window.open = SymWinOpen;

    //-->
    </script>

    <script src="http://www.pets4homes.co.uk/pets4homes/home.nsf/General.js" type="text/javascript"></script>
    <script src="http://www.pets4homes.co.uk/pets4homes/home.nsf/AllPetTypes.js" type="text/javascript"></script>
    <script src="http://onlinecount.com/onnow.php?site=ss02645" language="javascript" type="text/javascript"></script>
    <LINK REL="stylesheet" TYPE="text/css" HREF="tabbed.css">

  • #6
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by pets4homes View Post
    Hi,

    Thanks for replying again. I have just spoke to one user who is getting the problem and he is using microsoft IE. The select field is turning blue when he selects a pet type.

    I have only just started using absolute URL for JS files, i thought the relative ones may have caused problems.

    I also asked him to send me the source of the page when he does a view source and noticed the following differences from mine:
    Then I think that the third-party code to which you are linking, needs to be removed for elimination.

  • #7
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I done a bit of reading about the 'function SysError()' javascript and I think its inserted by Norton Antivirus which is stopping my javascript being loaded/run properly.

    My question is, how do I get around this problem without having to tell my users to disable their norton anti-virus? Surely there is a way around this??

    Thanks
    Mark


  •  

    Posting Permissions

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