Disabling Scriptaculous autocomplete

109 views
Skip to first unread message

Nithi

unread,
Sep 11, 2008, 3:04:13 AM9/11/08
to Prototype & script.aculo.us
Hi,

I have a question regarding disabling Scriptaculous autocomplete with
a input checkbox. I want to disable autocomplete when the user
unchecks the checkbox.

I tried keeping a toggle variable and using it but I couldn't do it. I
went through this PATCH link (http://dev.rubyonrails.org/ticket/7210)
but couldn't get it working.

Please suggest some method to disable the autocomplete request.
Thanks in advance.

bluezehn

unread,
Sep 11, 2008, 6:07:58 AM9/11/08
to Prototype & script.aculo.us
Since an autocompleter is just an object, then you can just store it
in a variable.
So when the checkbox is unchecked, you can just set the variable to
null and when it's checked again call the code to recreate the
checkbox over. This would be my basic approach but you'd have a few
issues with things like making sure listeners aren't added twice etc.
Best bet to have a look at the source and see how it runs.

Nithi

unread,
Sep 11, 2008, 11:13:22 PM9/11/08
to Prototype & script.aculo.us
I tried that. Once I initialize that variable I am not able to
reassign it to anything else.
I even tried changing the searchbox tag name when I click the checkbox
so that it wont show up on the screen. It just isn't working

On Sep 11, 3:07 pm, bluezehn <middlesh...@googlemail.com> wrote:
> Since an autocompleter is just an object, then you can just store it
> in a variable.
> So when the checkbox is unchecked, you can just set the variable to
> null and when it's checked again call the code to recreate the
> checkbox over. This would be my basic approach but you'd have a few
> issues with things like making sure listeners aren't added twice etc.
> Best bet to have a look at the source and see how it runs.
>
> On Sep 11, 8:04 am, Nithi <nithi...@gmail.com> wrote:
>
> > Hi,
>
> > I have a question regardingdisablingScriptaculousautocompletewith
> > a input checkbox. I want to disableautocompletewhen the user

Perryism

unread,
Oct 28, 2008, 3:22:13 PM10/28/08
to Prototype & script.aculo.us
This is how I fixed it.
open scriptaculous/controls.js

adding a new property, disable, to the autocompleter and set it to
false as default.

this.disable = false;

In onObserverEvent, replacing
if(this.getToken().length>=this.options.minChars)
with
if(this.getToken().length>=this.options.minChars && !
this.disable)

Reply all
Reply to author
Forward
0 new messages