473,320 Members | 2,193 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,320 software developers and data experts.

Another IE7 - Onchange Events

7
I need to define a text box that accepts a string input. If the user enters a value thats invalid I want to display a warning but prevent him from taking focus away from that box unless he corrects the data input.

For example:
<input name="Textbox1" value="Hello World One" onchange="if (this.value == 'bug'){alert('Error: - 1'); return false;}"></input>

In this test if i enter 'bug' focus should not leave this field unless i change 'bug' to something else and I should get the alert each time i attempt to.

This input field works fine under IE6 but under firefox or IE 7.

I heard that IE 6 used standards that were not in compliance with W3C...I dont know if this is the reason why i have this problem :(

Hi, I posted this question in the area for JavaScript related questions but I felt maybe someone who focued more on HTML in general would be able to help.
Feb 11 '08 #1
5 2448
harshmaul
490 Expert 256MB
hi,
Its a semi html question but more for javascript anyway////
try onblur instead of onchange.
Feb 11 '08 #2
Saith
7
Thanks, my post is still there...so far I got one response. Apparently no one wants to touch that one lol

onblur didnt work for me. if a onChange even fires when you tab out of a field, I wish there was a way to reset the field so if you tried to tab out again the onChange would fire again. its like the browser remembers it was fired so decides that well since i did it once I dont need to do it again for the same input.
Feb 11 '08 #3
harshmaul
490 Expert 256MB
Hi again.
Try writting a function that not only pops up the alert but also... makes the input box in focus aswell. if you have difficulty i'll help you tomorow, but i gotta go or i'm gonna miss my train!!

good luck mate.
Feb 11 '08 #4
Saith
7
Thanks harshmaul, i'll try that today and post if I run into issues
Feb 11 '08 #5
drhowarddrfine
7,435 Expert 4TB
Please do not double post. This is not a html/css question.
Thread closed.
Feb 11 '08 #6

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

Similar topics

3
by: NewmanBT | last post by:
As you can see from the code below, several textboxes will be dynamically created and each will be tied to an org. The ChangeComment function should allow for an update to the database whenever...
3
by: Clarence Gardner | last post by:
I'm seeing surprising behavior, consistent across Opera, Firefox, and IE. An event handler is changing the value of an element, and there is apparently no Change event being generated for the...
1
by: Christoph | last post by:
I'm trying to validate some HTML form elements when the user tabs out of each element. However, I'm having some problems. It appears that the order of events is onChange followed some time...
13
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is...
8
by: Geoff Cox | last post by:
Hello, When using Internet Explorer, on networked PCs in a college, to view a page of mine with Javascript code in it the "stack overflow" error message appears. When I access the same file...
2
by: Tom Cole | last post by:
Whilst I have no immediate need for it, I've noticed that if a select element is changed via setting the selectedIndex value, it does not fire an onchange event. Is there any reason for this? Both...
1
by: daokfella | last post by:
I need to raise the onchange event and Firefox is giving me some grief. I hear fireEvent is buggy with some events. Is that true? My code is simply this: targetTextbox.fireEvent("onChange"); ...
2
by: Mark | last post by:
Sorry for the double post, but I got no responses from the first group... I have a sample page. See link. http://comptrex.com/star/startest.htm It has a select box that contains a list of...
7
by: TriAdmin | last post by:
I am working with a system that allow me to add custom fields but I can not add OnChange() language to the custom fields. So I want to have a function in the header that recognizes when fieldx is...
13
by: andypb123 | last post by:
Hello, The onchange event fires in IE6 in a SELECT element when scrolling through the list with the up and down arrows on the keyboard. In Firefox it only fires after you hit the enter key, which...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.