This project is archived and is in readonly mode.

#568 ✓invalid
Fábio M. Costa

autocomplete dont fire onchange event ie

Reported by Fábio M. Costa | January 23rd, 2009 @ 06:00 PM

IE doenst fire the onchange event when you select an option of his autocomplete feature. It's dicussed here:

http://jehiah.cz/archive/onchang...

First comment there says that using onpropertychange, but it doesnt work as it should.

I did one fix but it doesnt look pretty (its attached). If it matters... you guys could make a better one.

Comments and changes to this ticket

  • Fábio M. Costa

    Fábio M. Costa January 24th, 2009 @ 01:56 AM

    I think that this function might be more complex to work with all kind of inputs (i just tested with text inputs). But its still good since it fixes the problem showed on the link above and it is fired when you change the value of the input using javascript, wish is nice.

    But i think this is something to think about, cause some events dont work the same on all browsers and with mootools api its possible to fix them.

    A thing that could be added to the 'custom events API' is a initializer, thats called at the time you add the event. It would help on this idea of 'fixing' the events.

    Like:

    
    Element.Events.someevent = {
     
     base:'otherevent',
     initialize: function(){},
     condition: function(e){}
    
    };
    

    so one would be able to 'fix' the change event like this:

    
    Element.Events.change = {
     
     initialize: function(){
      this.addEvent('focus',function(){
       this.store('change-fix-old-value',this.get('value'));
      });
     },
     base: 'blur',
     condition: function(){
      return (this.get('value') != this.retrieve('change-fix-old-value')); 
     }
    
    }
    

    These are just some thoughts i wanted to share... Keep up the excelent work! luv mootools...

  • Fábio M. Costa

    Fábio M. Costa January 28th, 2009 @ 07:42 PM

    I think that you can close this ticket. Theres still an undocumented 'initializer' for the events. Its the onAdd Right? So code above can be:

    
    Element.Events.change = {
     
     onAdd: function(){
      this.addEvent('focus',function(){
       this.store('change-fix-old-value',this.get('value'));
      });
     },
     base: 'blur',
     condition: function(){
      return (this.get('value') != this.retrieve('change-fix-old-value')); 
     }
    
    }
    

    And it may work... Close this ticket please. Some documentation about this would be nice dou.

  • fakedarren

    fakedarren February 8th, 2010 @ 05:06 PM

    • Milestone cleared.
    • State changed from “new” to “invalid”
    • Assigned user cleared.

    Closing ticket as per Fabio's request :D

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Attachments

Pages