On Jul 21, 10:50 pm, Bobby Brown <
browne...@gmail.com> wrote:
> thanks so much, that worked great. could you point me to the
> documentation for that?
>
http://github.com/madrobby/scriptaculous/wikis/ajax-autocompleter,
section "Server return".
> so..... what is the "select" option for then? because obviously i'm
> not understanding it correctly.
>
I've never noticed the 'select' option before. Looking at the code it
seems to be intended as a alternative to 'informal'; but it must be a
string containing a classname. However I'm a little dubious that it
behaves right. The relevant lines are:
if (this.options.select) {
var nodes = $(selectedElement).select('.' + this.options.select)
|| [];
if(nodes.length>0) value = Element.collectTextNodes(nodes[0],
this.options.select);
} else
value = Element.collectTextNodesIgnoreClass(selectedElement,
'informal');
which seems to say to me that it gets all the nodes with the given
class, and then takes the text nodes out of the first of them (only).
The second argument to collectTextNodes is completely ignored. So this
looks like a bit of a mess to me, as well as being inadequately
documented.
If I'm right, you can't do it the way you want, because 'selected'
will only take a class; but then it is almost a duplicate of
'informal', so it doesn't look as if it's been thought out. However,
what you're trying to do wouldn't work in any case, because you'd have
duplicated id's "selected_text" in each <li>. If you made it
<div class='selected_text'>
and then
{select:"selected_text}
I think it will work. But having looked at the code, I would avoid
'select'!