Solved

focus/blur mozilla problems

Posted on 2004-09-08
9
272 Views
Last Modified: 2008-02-01
Hi all,

I use the following function without problems in almost any browser (in NS4 does not work, but that is not a problem):

function dF( f, c ){
      var d = window.document.forms[f].elements[c];
      d.blur();
      d.focus();
      if( d.value != "" ){ d.select(); }
}

I call dF in two manners:

1) <body onload="dF('myForm','myField');"> // No problem

2) When current field.maxLength has been reached or enter key is pressed, set focus to next field // Here comes the problems in FireFox

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 :: /js/TMP9tegb3qfj3.php :: dF :: line 209"  data: no]
Source File: js/TMP9tegb3qfj3.php Line: 209

Any suggestions?

Thanks in advance
0
Comment
Question by:nenufarloganx
  • 5
  • 4
9 Comments
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
The field to be selected is NOT an <input> field. It is a <select> and therefore you cannot call select() on it.
0
 
LVL 3

Author Comment

by:nenufarloganx
Comment Utility

That's not the problem Zvonko (but thanks!)

The form is:

<body onLoad="dF( 'pepe', 'dni' )">
<form action="#" method="post" name="pepe" id="pepe">
<input name="cif" type="text" maxlength="9" tabindex="1">
<input name="dni" type="text" maxlength="9" tabindex="2">
<input name="nif" type="text" maxlength="9" tabindex="3" onClick="dF( 'pepe', 'cif' )">
</form>
</body>

As u can see there aren't selects :)
0
 
LVL 3

Author Comment

by:nenufarloganx
Comment Utility
btw,

errors are in this lines:

d.blur();
d.focus();
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
What FireFox version? Because it works in Mozilla1.7.2
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
Ok, I downloaded Firefox0.9.3 and the strange thing is that the function IS executed even that the exception message occures.
0
 
LVL 3

Author Comment

by:nenufarloganx
Comment Utility
yup, thats the matter
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 400 total points
Comment Utility
I have four four postings on the net with exact the same symptoms, bot no solution.
I have tried adding fields, remoing tabindex, commenting all calls in the script, disabling popup blocker, testing in save mode, but nothing indicated any solution.

So I am sorry, I see no solution here.
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
Thanks for the points.
0
 
LVL 3

Author Comment

by:nenufarloganx
Comment Utility
You earned it :)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now