[Catalyst] Prototype: what determines replaced text for complex
autocomplete?
Bill Moseley
moseley at hank.org
Mon Nov 28 22:54:01 CET 2005
http://script.aculo.us/demos/ajax/autocompleter_customized
Here's the HTML and call to Autocompleter:
To: <br/>
<input autocomplete="off" id="message_to" name="message[to]" size="30" type="text" value="" />
<div class="auto_complete" id="message_to_auto_complete"></div>
<script type="text/javascript">new Ajax.Autocompleter('message_to', 'message_to_auto_complete', '/demos/ajax/auto_complete_for_message_to', {})
</script><br/>
The ajax request returns a complex list item: (sorry for the wide
output)
$ GET 'http://script.aculo.us/demos/ajax/auto_complete_for_message_to?message[to]=a'
<ul class="contacts">
<li class="contact"><div class="image"><img src="/demos/images/contacts/5.jpg"/></div><div class="name">Ada Noel</div><div class="email"><span class="informal">ada at noel.fake</span></div></li>
<li class="contact"><div class="image"><img src="/demos/images/contacts/8.jpg"/></div><div class="name">Adlai Cathy</div><div class="email"><span class="informal">adlai at cathy.fake</span></div></li>
<li class="contact"><div class="image"><img src="/demos/images/contacts/3.jpg"/></div><div class="name">Adrian Audrey</div><div class="email"><span class="informal">adrian at audrey.fake</span></div></li>
[...]
</ul>
What I don't see is what says to use "name" as the text to replace?
That is, when the pop-up list is shown and I click on a name, what
says to update the text field with the name (instead of the email, for
example)?
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list