...

View Full Version : problem populating select list



pets4homes
10-12-2006, 09:10 PM
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/pets4homes/home.nsf/PlaceAdvert?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

Arty Effem
10-13-2006, 02:20 AM
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
document.forms[0].BreedTX[0].text = "All Pet Breeds";

/* and */

document.forms[0].BreedTX[i+1].text = keywordArray[ kwd ][ i ];to

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.

pets4homes
10-16-2006, 10:22 PM
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

Arty Effem
10-17-2006, 12:39 AM
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:
<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.

pets4homes
10-17-2006, 12:03 PM
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">

Arty Effem
10-17-2006, 02:42 PM
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.

pets4homes
10-17-2006, 02:54 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum