467,910 Members | 1,699 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Another IE7 - Onchange Events

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
  • viewed: 2289
Share:
5 Replies
harshmaul
Expert 256MB
hi,
Its a semi html question but more for javascript anyway////
try onblur instead of onchange.
Feb 11 '08 #2
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
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
Thanks harshmaul, i'll try that today and post if I run into issues
Feb 11 '08 #5
drhowarddrfine
Expert 4TB
Please do not double post. This is not a html/css question.
Thread closed.
Feb 11 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by NewmanBT | last post: by
3 posts views Thread by Clarence Gardner | last post: by
1 post views Thread by Christoph | last post: by
8 posts views Thread by Geoff Cox | last post: by
2 posts views Thread by Tom Cole | last post: by
1 post views Thread by daokfella | last post: by
2 posts views Thread by Mark | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.