Forum Moderators: open
I don't have any problems with the javascript working and neither does my client. But some schools administrators and parents that load the page are having problems with it not working. The only thing I can do to break the page for myself is to disable javascript (Which then gives the user an error about javascript not being available) or set my security settings to "High" in IE.
I'm at the end of my rope here trying to figure this problem out..
If anyone just notices something terribly wrong, please let me know. I've exhausted my resources trying to fix this problem (Which is very hard to do since I'm not the one actually experiencing the problem)
Kevin
[edited by: Fotiman at 1:57 pm (utc) on Oct. 17, 2008]
[edit reason] No URLS per the TOS please. [/edit]
I cannot onchange to onblur, as the end users expect instant gratification when they click that state in the select menu. Thank you for the suggestion (really) but changing to onblur isn't really an option here in this particular case. This site is a makeover of an older site that functioned in exactly the same way, using onchange for the select menus. The only difference is that the old site actually WORKS for all of the users :)
Kevin
I am wondering if it is because of an older browser.
Onchange should work especially for select boxes....
You can try leaving the OnChange and add an onBlur that calls the same function...
<select name="state" id="state" size="15" onchange="updateschools(this.options[this.selectedIndex].value);" onblur="updateschools(this.options[this.selectedIndex].value);">
<select name="schools" id="schools" size="15" onchange="updatebuttons();" onblur="updatebuttons();">
You can even add an onClick method.
Really the best thing you can do if this won't work is have someone give you a detailed report of the error.
Ask them when they get it to record.
1) The exact string in the address bar
2) The OS of the machine
3) The browser type and version
4) Which item did they select
5) Did they select an item before and it worked?
6) How did they select the item? Clicking? Keyboard arrows? Tab + space bar?
7) What exactly happens when it errors? A message? Nothing happens? Browser crashes?
Once you have this type of information you will have an easier time debugging it.... the worst errors are the ones you can't reproduce.... once you can reproduce the error it will be so much easier to debug.
And, amazingly enough, I've just discovered something else that makes my job even more difficult - The computers that cannot run the javascript on the page linked to above....Can run another javascript form on the same website that is using onchange events on select boxes.
So basically, I've got onchange events on one form that aren't working for the user, but the onchange events on another form are working for the user....and I've got no idea why (I even took remote control of the computer and could not get it to work).
The only thing I've discovered is that my javascript was missing a semi-colon in one of the functions. I'm not sure if that was the cause of the problems (It was the function that updated the second select box, so it's entirely possible) because I know JS doesn't require semicolons.....But I'm hopeful that it will magically be fixed after adding it. I'm waiting to hear back from the user to see if it solves their issues.
Hopefully that's all it is, and I can rest peacefully :)
Thanks again for your advice.
[edited by: kcackler at 8:11 pm (utc) on Oct. 15, 2008]
We'll continue our search.
If you have any other ideas, please let me know.
<script type="text/javascript" src="find_my_school.js.php"></script>
maybe it needs a slash or some computers mess up the path?
<script type="text/javascript" src="/find_my_school.js.php"></script>
Also it could be that they don't like the file extension of your JS file and ignore it because it doesn't end in .JS.. I am stretching here now though...
It would be great if we knew what error they are getting..... no such function.... x is not defined.... like what is the error?
[edited by: Demaestro at 9:32 pm (utc) on Oct. 15, 2008]
From what I understand - There are no errors. The second list just doesn't update. I'm about to give up and throw an alert into the function to see if that is even triggered.....
Before I had the onchange function being passed an argument, ie onchange="updatebox(this.options[this.selectedIndex].value);"
Once I changed the function to just updatebox() and had the function itself grab the value, everything is working fine for everyone......It really doesn't make sense to me at all.
Maybe some machines were so slow that they registered the onchange and called the function but hadn't yet in memory selected the item and so when it called the function there was no this.selectedIndex in memory yet.
Sounds far fetched saying it but you never know. Not the first time I have seen something not work locally but work when called from an external file.