Another IE7 - Onchange Events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Saith
    New Member
    • Feb 2008
    • 7

    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('E rror: - 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.
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    hi,
    Its a semi html question but more for javascript anyway////
    try onblur instead of onchange.

    Comment

    • Saith
      New Member
      • Feb 2008
      • 7

      #3
      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.

      Comment

      • harshmaul
        Recognized Expert Contributor
        • Jul 2007
        • 490

        #4
        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.

        Comment

        • Saith
          New Member
          • Feb 2008
          • 7

          #5
          Thanks harshmaul, i'll try that today and post if I run into issues

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            Please do not double post. This is not a html/css question.
            Thread closed.

            Comment

            Working...