Hi,
I have auto_complete working generating a list and populating a text
box in a form. The problem arises when I add the :on_hide option as
follows:
<%= auto_complete_field "search",
{ :url => {:action => "search"}, :on_hide =>
"foo($(''selected_uid''),
$(''search_list''))"} > %>
:on_hide makes everything stop working (''search'' action
doesn''t get
called); in addition, the div that is supposed to contain the
selection list becomes visible beneath the text box as an ugly grey
bar.
Also, the javascript in the on_hide parameter gets executed on page
load; why is that?
Here''s the generated html for the form:
<form action="/users/show" method="post">
Search by surname:
<input autocomplete="off" id="search"
name="search" type="text" />
<div id="search_auto_complete"></div>
<input type="hidden" name="selected_uid"
id="selected_uid"/>
<script type="text/javascript">
//<![CDATA[
new Ajax.Autocompleter(''search'',
''search_auto_complete'',
''/users/search'',
{onHide:foo($(''selected_uid''),
$(''search_list''))})
//]]>
</script>
<input name="commit" type="submit"
value="Show" />
</form>
Anyone have some working auto_complete_field code that uses :on_hide
(or :on_show) that they could share?
Thanks!
jh
--
James Hughes
Web application developer
Centre for Health Services and Policy Research
Vancouver, BC
"Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid''s game of dot-to-dot."
- Ward Churchill, from ''"A Government of Laws"?''