> For a project i am playing around with the Ajax.Autocompleter. It has
> basicly the functionality i need but with the little difference that i would
> rather use it as LiveSearch with clickable links instead of auto-completing
> a inputfield. Any ideas how i can make it so that, if a user selects a
> result it does not go to the inputfield but the link/result he chooses
> (either with keyboard+enter or mousclick) will be launched?

> TIA, Kjell

I'm using:

    <input type="text" id="busqueda" name="busqueda" />
    <div id="busqueda_auto_complete" class="auto_complete" 
style="display:none"></div>
<script type="text/javascript">
    function busqueda_eligio(elegido) {
      url = elegido.getElementsByTagName("span")[0].innerHTML;
      window.location = url;
      }
    new Ajax.Autocompleter("busqueda", "busqueda_auto_complete",
        "<%= escape_javascript(url_for(:controller => 'buscador', :action=> 
'complete_me')) -%>",
        {updateElement: busqueda_eligio,
         frequency: 0,
         method: 'get',
         onShow: function(element, 
update){Effect.Appear(update,{duration:0.15});} } );
</script>

And in the view that provide the options:

<ul>
<% @datos.each do |x| -%>
  <li><span style="display: none"><%= x[1] -%></span><%= x[0] -%></li>
<% end -%>
</ul>


Hope it helps,
                                        HoraPe
---
Horacio J. Peña
[EMAIL PROTECTED]
[EMAIL PROTECTED]
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to