Solved

focus/blur mozilla problems

Posted on 2004-09-08
9
280 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:Logan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 12008948
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:Logan
ID: 12009088

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:Logan
ID: 12009098
btw,

errors are in this lines:

d.blur();
d.focus();
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 63

Expert Comment

by:Zvonko
ID: 12009153
What FireFox version? Because it works in Mozilla1.7.2
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12009296
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:Logan
ID: 12009486
yup, thats the matter
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 400 total points
ID: 12009936
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
ID: 12014924
Thanks for the points.
0
 
LVL 3

Author Comment

by:Logan
ID: 12014937
You earned it :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

738 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