Solved

focus/blur mozilla problems

Posted on 2004-09-08
9
278 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
age from date of birth 4 51
Javascript Form Change 5 31
tiny glitch in my main slider 3 38
how can i get the sole odd and th sole even 2 33
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

791 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