You do not want to alter the source code of scriptaculous, or at least
I would not recommend it since whenever you update your library to a
newer version you will lose those changes. You need to *extend* those
classes/modules in a separate JS file that is included after the
controls.js file is included.

I am not able to spend a lot of time helping you with code, but I can
offer some UNTESTED stuff. Note that I am using Function#wrap
(http://prototypejs.org/api/function/wrap) and Object#extend
(http://prototypejs.org/api/object/extend) to help. Typically this
code would go in your main application JS file or a overrides JS file.

Autocompleter.Base.prototype.baseInitialize =
Autocompleter.Base.prototype.baseInitialize.wrap(function(){
  var args = $A(arguments), proceed = args.shift();

  // call the original baseInitialize method with any passed in arguments
  proceed.apply(this, args);
  // attach a mouseup listener, a brute-force way to observe for a
mouse copy/paste event
  Event.observe(this.element, 'mouseup',
this.onKeyPress.bindAsEventListener(this));
});

Autocompleter.Base.addMethods({
  getToken: function() {
    var bounds = this.getTokenBounds();
    // same code as the original getToken method except we're not
calling strip() on the string
    return this.element.value.substring(bounds[0], bounds[1]);
  },
});

On Fri, Sep 12, 2008 at 12:50 PM, Jack D <[EMAIL PROTECTED]> wrote:
>    Will there be any impact on any other part of the autocompleter? I mean
> what would be the side efftect of the above 2 soluns?

The side effect of the additional observer is it will fire when *ANY*
mouseup event is fired whenever the autocompleter input control has
focus.

The side effect of overriding the getToken method is that literally
whatever is input into the autocompleter control will be passed
through to the server. Leading spaces, trailing spaces, etc...

-justin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to