Is it possible to use best_in_place with typeahead from twitter bootstrap?

Posted by Dave H on Stack Overflow See other posts from Stack Overflow or by Dave H
Published on 2012-03-18T17:53:35Z Indexed on 2012/03/18 17:56 UTC
Read the original article Hit count: 469

Basically, I am using best_in_place in my rails webapp to let users edit their profile info in place. The thing is, I would like users to be presented with a typeahead form for certain entries.. Here's what I'm working with:

<p>College/University: <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="8" data-source='["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]'></p>

This gives me a working form box with typeahead. However, I want to be able to wrap this in best_in_place with something like

<%= best_in_place @student, :education %>

so that users only see the typeahead form when they click on the text, and upon clicking away from the box or hitting enter the selection is stored in the database.

Is there a reasonably easy way to do this?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-3