Re: JavaScript error with onChange event handler -- FireFox 1.5
- From: "VK" <schools_ring@xxxxxxxxx>
- Date: 5 Apr 2006 01:25:12 -0700
David McNerney wrote:
Would anyone be able to tell me why I get an error in FireFox 1.5.0.1
for MacOSX when I type some text and hit Enter in the following form:
<html>
<body>
<form action="http://example.com" onSubmit="return false;">
<input type="text" name="samplenum" value=""
onChange="alert('onChange fired');">
<input type="submit" name="cmd_submit" value="Submit"
onClick="return false">
</form>
</body>
</html>
Needless to say, this is a pruned down toy example. It seems like there
must be a bug, but I'd like to make sure that I'm not doing something
wrong. I don't get the error if I remove the onChange event handler.
The error reads:
Error: [Exception... "'Permission denied to set property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::
file:///Users/dave/sy_dir/u01/app/lims/httpd/htdocs/ajax.html ::
onchange :: line 1" data: no]
Source File:
file:///Users/dave/sy_dir/u01/app/lims/httpd/htdocs/ajax.html
Line: 1
That looks like the old autocomplete bug, but it was fixed in Firefox
1.5. Are you sure that your version is 1.5 and not say 1.0.7? If indeed
then somehow it was preserved in the MacOS build. Under Windows (98 and
XP) it was fixed for sure - I don't know why other respondent says it
was not. You code runs w/o exceptions on test machines.
The fix is to use autocomplete="off"
<input type="text" name="samplenum" value=""
autocomplete="off"
onChange="alert('onChange fired');">
Of course it is not an option if you *need* to have autocomplete on.
Also this bug leads to an exception, not to an error: it means that
script execution is not aborted. But numerous exceptions may lead to an
execution slow-down (plus JavaScript console gets "pollued")
.
- Follow-Ups:
- References:
- JavaScript error with onChange event handler -- FireFox 1.5
- From: David McNerney
- JavaScript error with onChange event handler -- FireFox 1.5
- Prev by Date: Re: chek where mouse is
- Next by Date: Re: Any way to identify/capture back button event?
- Previous by thread: Re: JavaScript error with onChange event handler -- FireFox 1.5
- Next by thread: Re: JavaScript error with onChange event handler -- FireFox 1.5
- Index(es):
Relevant Pages
|