In_place_editor with local autocomplete


Hi Rails gals n guys

I am trying to enhance the “Lightning-Fast JavaScript Autocompletion”
rails recipe. For those that do not have the pdf-book the recipe
explains how to use a javascript array for an auto-complete text field.

I want to combine this with the in_place_editor call. My current
(unworking) code:

Change Style

<%= in_place_editor( “style_lookup”, { :url => url_for( :controller =>
“styles”, :action => “style_jdetails” ), :script => true } ) %>

<%= javascript_tag(“new Autocompleter.Local( ‘style_lookup’ ,
‘style_auto_complete’, styleArray, { fullSearch: true, frequency: 0,
minChars: 1 });”) %>

The problem here is that in_place_editor creates an input tag with no
id, so the Autocompleter can not find it.

Even if I could get the in_place_editor to id the input, would the
Autocompleter work since the input tag does not exist when the document

Sounds like I’m going to have to create two divs, one with value and one
with input, and switch their visibility. Other suggestions?