Geeks With Blogs
Shahed's blog Sharing my thoughts and work
Finally I found a simple solution for the FireFox error:

"[Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"

This error occurs when focus() is called. I was reported in https://bugzilla.mozilla.org/show_bug.cgi?id=236791 but still no fix/patch from mozilla.
To avoid this error, you have to turn off autocomplete.

from javascript, you can do that in following way: obj.setAttribute('autocomplete','off');

Or, you can simply set autocomplete="off" in HTML. Posted on Monday, August 14, 2006 2:48 PM Javascript | Back to top


Comments on this post: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Dear Sir,

Thank you very much for your simple but great tip. We have been trying to solve this problem for the last two weeks.

Once again thanks . . .


Regards,

Silicon Team

Left by Silicon Team on Jan 09, 2007 2:41 PM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Thanks for posting this! It saved me loads of debugging time.
Left by Grant on Jan 12, 2007 6:23 PM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Thanks for the fix! I'm glad I found this before tearing out too much of my hair.
Left by TheForgotton on Feb 02, 2007 6:11 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
If you use the autocomplete="off" in HTML, FireFox may continue to issue a validation error.

A workaround strategy is to put the following snippet within your document onLoad function.

/**
* turn off the autocomplete attribute for all <input> elements :: fix to a bug with FireFox
*/
var eleObjArr=document.getElementsByTagName("input");
for(var i=0; i<eleObjArr.length; i++)
{
if( eleObjArr[i].getAttribute("autocomplete") )
{
eleObjArr[i].setAttribute('autocomplete','off');
}
}
Left by Unga on Apr 26, 2007 1:11 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Hi Unga,

It may not be a good idea to set autocomplete=off for all elements. Some UI may need this feature depending on implementation logic.

Firefox shows that error only for hidden/not visible elements. Could you please tell me more about the errors you said "FireFox may continue to issue a validation error".
Left by shahed on Apr 27, 2007 7:39 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Thank you so so much this saved me a lot of head scratching
Left by bob on Jul 13, 2007 6:03 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Shahed,

Thanks! This saved me some time.

I found a work around if you change the format of the input element. You can use JavaScript to auto fill drop-down selections but not text boxes. You can disable the drop-down so that the selection can't be changed.
Left by Rosie on Nov 30, 2007 10:45 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Thank you very much sir for giving valuable tip
Left by selvi on Feb 20, 2008 9:13 PM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Just encountered this 'permission denied to set property' error.

I have a page with an iframe that shows various graphics.
var called in parent myimage
when html page in iframe changed, page sends parent.myimage = "my.jpg"

FFox 3 Beta 5 / latest Ubuntu throws error.

Previous versions of Linux FireFox did not. FireFox 2.x on WinXP and Vista and Mac do not throw error. No error from Safari Mac or Win or from Opera Mac, Win, Linux.

Hope this gets caught in beta.
Left by Richard Robinson on May 30, 2008 6:42 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
Like everyone else - Thanks a lot for saving tons of debugging time. I've been at this one for the last two days, pulling my hair.

Simple fix:

<script>
function setFocus(o)
{
var fi = document.getElementById(o);
if (!fv) return;
fi.setAttribute('autocomplete','off');
fi.focus();
fi.setAttribute('autocomplete','on');
}
<script>
Left by hls on Feb 28, 2009 8:36 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
God bless u for "obj.setAttribute('autocomplete','off'); ".
I love these one-liners. :)))))
Almost tried the hundred line long fixes :)))
Left by Alex on Apr 10, 2009 3:58 AM

# re: FireFox error: [Exception... "'Permission denied to set property XULElement.selectedIndex' ...
Requesting Gravatar...
We can use that think also:

$('input').attr('autocomplete','off');

by which we can also prevent.
Left by vikas Gupta on May 30, 2009 6:51 PM

Your comment:
 (will show your gravatar)


Copyright © Shahedul Huq Khandkar | Powered by: GeeksWithBlogs.net