473,624 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with focus

ra
Hi

I can't figure this out - I have a routine that is triggered after a text
field is changed and if an error it displays an alert message and should put
focus back to the field in error but focus or select won't seem to work -
the cursor just stays in the next field.

Im using IE6.0

The code is like

<script>
CheckNumeric(nu m){
// Some error checking code
if (error)
{num.focus();
num.select();}}
</script>
// some more html...
<input name="t1" type="text" size="5"
onchange='javas cript:CheckNume ric(this)'>
/// and so forth...



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #1
1 4056
Yeah I've run in to this also. The problem is that the onBlur event for the
input fires after the onChange method. So while the focus is being set in
the onChange event, the onBlur event is called next and the input loses its
focus.

You may want to try to kill the event chain by setting the event.returnVal ue
to false or and this is what I do, is give up on the onChange event and
implement the same code in the onBlur event. Yeah you may incur slight
overhead because now you are processing the input field every time you tab
off the control rather than only when the value changes, but if you need to
you can always code this functionality easily in the onBlur handler method
with a simple "if" statement.

Regards
Mike

"ra" <r@yahoo.com> wrote in message news:3f******** **@corp.newsgro ups.com...
Hi

I can't figure this out - I have a routine that is triggered after a text
field is changed and if an error it displays an alert message and should put focus back to the field in error but focus or select won't seem to work -
the cursor just stays in the next field.

Im using IE6.0

The code is like

<script>
CheckNumeric(nu m){
// Some error checking code
if (error)
{num.focus();
num.select();}}
</script>
// some more html...
<input name="t1" type="text" size="5"
onchange='javas cript:CheckNume ric(this)'>
/// and so forth...



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1604
by: Dave | last post by:
Hi all, I have a problem with a query. (well, I actually have a few problems...) Here is my query. select FOCUS.SiteName, FOCUS.URL, OTWAdCars.* , REGION.SiteName as RegionSite, REGION.URL as RegionUrl from OTWSite as FOCUS right join OTWSite as REGION
4
2211
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for time and there is also a check on that. If time is empty return error message. Again the explorer returns error message and then shifts the focus to date field, again error message and focus goes to time and this story goes on and on, untill...
1
2475
by: Ricardo Garcia | last post by:
hi, i have the next situation: an index.html that has 2 frames (the main and the navigation bar) and the next problem (in IE, in Mozilla it works properly): when i start to scroll in the main window, it blurs, and of course, it finish scrolling, you must click to focus again. This is rather annoying. And i know that the other frame does not get the focus (i put an alert if it got, and it didn´t appear) I know is a problem of the focus...
2
3091
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a Mozilla-only problem) I'm capturing the focus and blur events for the document, updating a
6
1696
by: nizar.jouini | last post by:
I have web page that contains two links. link "a" and link "b". When I click on "a" a small window should pop up. when I click on "b" another small window should pop up. So what you should see now is the base window which contains links "a" and "b" and two small pop-up windows "a" and "b". Now I can make the script to pop up "a" and "b" but the problem is that they're not shown at the same time. Any suggestions????
1
2230
by: avnrao | last post by:
Hi, I am facing a problem with control.focus (javascript). Here is the description of the issue. 1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on this, will redirect page to Aspx2 which has a Datagrid. PageLoad of Aspx2 displays the DataGrid with existing data filled in and shows a new row (set of text boxes) in the Footer Item. Now, when I set the focus by accessing the first text box in the Footer
1
5132
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
3
1381
by: ngkuhlmann | last post by:
I have a strange problem. I have a tab control with 5 tabs. When I click one of the tabs the tab show its information just fine, however when I test the focus, without moving and within a timer control, the focus returns a false. Any thoughts? TIA, Noral
3
4242
by: jan.loucka | last post by:
Hi, I looked around for this specific problem but could not find any answer - there's few things in VB but still nothing exactly like this so I'd appreciate any help. We're writing C# WinForm application that need to "silently" use another app (called MapInfo) within itself - the intention is to use this app (which is quite sophisticated mapping application) and add some other extra functionality to it. We have a dll so we can run the...
1
3106
by: Drelus | last post by:
I'm using an Ajax call to open a search box in the page and I want the focus to go to the box automatically. So, in the httpObject.responseText, I tried sending the following in addition to the search box markup: <script type="text/javascript"> document.getElementById('Message').focus(); </script> and, after writing the response using innerHTML, the originating Ajax function calls an eval function to enable the JavaScript, the critical...
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.