473,385 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Javascript onBlur results in "hidden" cursor in text field

Hello,

I'm running into an interesting issue and I wanted to verify it was a bug with Internet Explorer 7.

I have a field that has an javascript onBlur event. When you set focus to the text field, it launches a custom event handler to process the existing value in that text field. Well after the onBlur function has completed, the cursor looks like it's not there, almost as if it didn't set focus to the text field you were currently on. But in fact, if you use the directional arrows on your keyboard, you'll see the focus has indeed been set to the text box, the cursor was just hidden! Has anyone else encountered this? I've been debugging this issue for a couple of days now before I rule out it's a bug in IE 7.

Thanks in advance.
Jan 14 '08 #1
12 11399
r035198x
13,262 8TB
Hello,

I'm running into an interesting issue and I wanted to verify it was a bug with Internet Explorer 7.

I have a field that has an javascript onBlur event. When you set focus to the text field, it launches a custom event handler to process the existing value in that text field. Well after the onBlur function has completed, the cursor looks like it's not there, almost as if it didn't set focus to the text field you were currently on. But in fact, if you use the directional arrows on your keyboard, you'll see the focus has indeed been set to the text box, the cursor was just hidden! Has anyone else encountered this? I've been debugging this issue for a couple of days now before I rule out it's a bug in IE 7.



Thanks in advance.
I've seen this happen a few times.Are you sure this only happens in IE because I'm sure I've seen this in Firefox as well.
It isn't a big problem is it?
Jan 14 '08 #2
In this particular case it's a big deal. If a user is completing a large form that has look-up pop-ups, each time the look-up window closes I'm setting focus back to the last field they were on via an onBlur. If the cursor isn't visible, the user doesn't know where they left off/which field the focus is set. This also occurs when they are tabbing through fields. When it gets to particular fields utilizing the onBlur event, it doesn't show the cursor. I can then tab to the next field and the cursor shows up fine. Very strange.
Jan 14 '08 #3
r035198x
13,262 8TB
In this particular case it's a big deal. If a user is completing a large form that has look-up pop-ups, each time the look-up window closes I'm setting focus back to the last field they were on via an onBlur. If the cursor isn't visible, the user doesn't know where they left off/which field the focus is set. This also occurs when they are tabbing through fields. When it gets to particular fields utilizing the onBlur event, it doesn't show the cursor. I can then tab to the next field and the cursor shows up fine. Very strange.
I suppose it is a big deal then. Have you tried the old hack of setting the focus to some other component first then setting it to the required control.
P.S Have you confirmed that this behavior is for IE only?
Jan 14 '08 #4
I haven't been able to test in Firefox. Our product is IE only. I have taken a look at it using the Firefox IE add-on (which uses the same IE engine). So that's not saying a whole lot. I'll create a test page with the basic javascript and we'll see if I can reproduce it in Firefox.

Thanks.
Jan 14 '08 #5
gits
5,390 Expert Mod 4TB
hi ...

i encountered the same problem in FF already ... to have the focused field marked as focused i decided to set its background-color too ... just to workaround the problem ... may be a setTimeout would help too when setting the focus ...

kind regards
Jan 14 '08 #6
Yeah I can reproduce in FireFox. Also, setting the timeout (setTimeout()) doesn't seem to work either. I put several setTimeout(s) in there to see if waiting on the cursor to reappear would do it; no dice.
Jan 14 '08 #7
gits
5,390 Expert Mod 4TB
hi ...

could you please post the code that makes the problem in FF ... i think i would like to play with it ... may be we find a solution :)

kind regards
Jan 14 '08 #8
Did you ever find a solution for this?

I just posted an issue where I said the screen was frozen..couldn't cursor anything...however, after reading this post, I can tab, and the the screen functions fine...but not really user friendly. I would like to get this resolved and feel your issue is similar to mine.

Anyone please post if you have the answer. thank you.
Feb 6 '08 #9
gits
5,390 Expert Mod 4TB
post some code to work with! so that we may reproduce the behaviour ... and search for a fix ...

kind regards
Feb 6 '08 #10
change the containers overflow css rule to auto. that works for FF. I think if its the same issue, it'll work for IE also.

Suppose you have this fragment.
Expand|Select|Wrap|Line Numbers
  1. <div>
  2. <input name="username" />
  3. </div>
make it
Expand|Select|Wrap|Line Numbers
  1. <div style="overflow:auto">
  2. <input name="username" />
  3. </div>
It worked for me.
Feb 11 '08 #11
I know its 6 months later, but I wish to post what for me was my solution to the same problem. And hopefully will help someone else out in the process. Good Karma etc.

Background: I had an auto suggestion textbox (A textbox with a listbox underneath that would appear or disappear depending on what the user was typing). In IE only, After I hid the listbox, the cursor (caret) in the textbox wouldn't re-appear even after I'ld set the focus back to the textbox. In FF and Opera the cursor (caret) would re-appear in the textbox as expected.
In IE, if I placed an alert() function before the textbox.focus(), then the cursor would appear correctly. Like the originally posters problem, even though the cursor (caret) wasn't appearing, I could see the textbox was the focuessed control because of the tab order.

Solution: In my case I was using listbox.style.visibility='hidden' to hide the auto suggestion listbox. When I replaced that with listbox.style.display='none' which in my case didn't have any knock on effects, this made the textbox.focus() to function correctly in IE.
It is possible in IE, that if I had set the focus to the textbox before I'd hidden the listbox, that this problem wouldn't have appeared, saddly because of all the onblur events etc going on, it was hard to arrange this.

I hope this helps someone as it caused me many hours of endless searching, and it wasn't until I read this thread, that I thought about thinking about the css styles that I was applying to the listbox control to hide it.
Sep 23 '08 #12
gits
5,390 Expert Mod 4TB
thank you for posting your hints - i'm sure this will be helpful for other people who might have a similar problem ...

kind regards
Sep 23 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Tom Petersen | last post by:
Here is the code: <SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; " size="1"> <% DO WHILE NOT objRS.EOF strEmail = objRS("email") strLName = objRS("last_name") strFName =...
9
by: Andrew Durstewitz | last post by:
Hi! I am having a really strange issue. I have a few users calling in saying they are getting an error. On further review I found this line is what is causing it... Set strLookup =...
1
by: Stone | last post by:
OK .. admittedly this is newbie dumb... Its a JAVA script in a FORM I have passed (successfully) the referring URL into my form page on loading.... <script language="JavaScript"><!-- //...
4
by: Mike | last post by:
Hi, I need to read an hidden field on the server side (code behind). I can modify the value in Javascript (client side), then call "form.submit();" on the client side. However, on the server...
2
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
2
by: Alexio | last post by:
Sample code snippet - <td align="right">Check Amount:&nbsp;</td> (1) <td><input type="text" name="CHK_input_1" size="19"style="text-align:right" onkeyup="calcCB();"...
2
Claus Mygind
by: Claus Mygind | last post by:
How do you get a trigger/event to fire on a hidden field. In this case I have a hidden field that is updated via a script. It seems when a field is updated in this manner none of the event triggers...
11
by: viki1967 | last post by:
Hidden field Hello my friends. This is a htm page that contains a form open in window popUp ( page daughter ). This form insert a value in the one hidden field called "tec", in other form...
14
Frinavale
by: Frinavale | last post by:
I've been trying to test my web application using Internet Explorer 8 (release candidate 1) and have been experiencing some major problems. I'm hoping you can help me with this one. I have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.