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 <[email protected]> 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 & script.aculo.us" 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/prototype-scriptaculous?hl=en.