Hi,

Working with Ajax.Autocompleter, I would like to show automatically
the end of the text inside the input after selection.
For example:
- my entry is "[EMAIL PROTECTED]"
- the input show only 10 characters
- only ten characters will be displayed after selection : [rails-spin]
=> I would like the 10 last characters displayed : [nrails.org]

I tryed this piece of code but it does nothing on Firefox 1.5 and 2.0 :'(
afterUpdateElement: function(element) {
 var p = element.value.length;
 if (element.setSelectionRange) {
    setTimeout(function () {
        this.setSelectionRange(p, p);
    }.bind(element), 10);
 } else if (element.createTextRange) {
    var range = element.createTextRange();
    range.collapse(true);
    range.moveEnd('character', p);
    range.moveStart('character', p);
    range.select();
 }
}

Have somebody understood my needs? It's a little bit difficult to explain...

Thanks for help,
Nicolas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to