PDA

View Full Version : Permission denied to get property XULElement.selectedIndex


boagworld
06-15-2005, 11:31 AM
Hi all,
first of all let me say I am a newbie both to this forum and to DOM scripting so please don't flame me if I am making an idiot of myself. A polite go away will do :)

I am trying to achieve a very simple thing. Basically when a user clicks in a form field I want it to clear the content. No problem I hear you cry.

First I detect which field they are clicking in and set that field as a var whichField. Then I do this:

whichField.value = "";

Works great. No problem except for an error being thrown up in the firefox javascript console. Which says:

Error: [Exception... "'Permission denied to get property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.boagworld.com/boagworld.js :: clearField :: line 34" data: no]
Source File: http://www.boagworld.com/boagworld.js
Line: 34

Now from looking around the web the only way this can be fixed appears to be by adding autocomplete="off" to the INPUT tag but this invalidates my code.

What should I do? Should I just ignore the error or does somebody have a nice fix.

To see all the javascipt involved go to:

www.boagworld.com/boagworld.js

Any help would be much appreciated.

rickeyFitts
02-09-2006, 03:14 AM
I struggled with this problem for half a day ....and finally found a simple fix.

Error: [Exception... "'Permission denied to get property XULElement..."

This is apparently a bug in FireFox's AutoComplete code. I found a reference to this in Bugzilla, and was able to avoid it like this:

<input type="text" autocomplete="off" name="fname"> etc.

The error message went away and all is well. It did not seem to have any problems in IE before or after adding the autocomplete parameter. Although technically autocomplete is not a "valid" parameter in XHTML 1.0 transitional, or probably most other versions of HTML/XHTML, it's the only way I could keep the FireFox exception from being thrown.

'hope this helps.