So I was looking at something that would only let them type values
that appear in the autocomplete list.  So, say it was a state list
(for example).  If you type in "cal" you would have California showing
up in the list.  Current autocomplete behavior allows them to type in
"Calasdfasdfasdfasdf" or whatever.  I'm curious if there is a solution
already implemented that would let them type CAL and would ignore
everything else until they typed the IFORNIA in the correct order.  In
other words, they're restricted to only the items on the autocomplete
list.  If we have AAAA, AAAB, AAAC then after they type AAA the only
options allowed to type would be A, B, or C.

On Jan 11, 7:34 am, shellster <> wrote:
> Should be pretty simple:
> var array = //your array of acceptable values;
> $('field).observe('keyup', checkword);
> function checkword()
> {
> var string = '/^' + RegExp.escape($('field').value) + '.*/';
> if(array.grep(string).length == 0)
> return false;
> else
> return true;
> }
> Is a rough start of something.
> On Jan 6, 2:38 pm, Strider <> wrote:
> > Has anyone implemented a restrict-to-list option in the autocompleter
> > or know any of the pitfalls I should watch out for?
> >  I would like to implement this option, for say State names, or such,
> > and I would rather restrict to the list than doing post-selection
> > error messages.  It seems like a feature that should be included (for
> > things like state names, or other limited lists.)
> > Does such a feature already exist (and I missed it in my search) or
> > has anyone already implemented it?
> > Thanks,
> > StriderA
You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to