Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1.47 KB

README.textile

File metadata and controls

44 lines (27 loc) · 1.47 KB

Formtastic jRails autocomplete

An extension for Formtastic1 to automagically support fields with auto completion, using jrails_auto_complete gem2 (unobtrusive javascript).
Should work also with other autocomplete plugins (FormBuilder must respond to text_field_with_auto_complete method).

Usage example

<% semantic_form_for @user do |form| %>
  <% form.inputs do %>
    <%= form.input :name, :as => :autocomplete, :min_length => 3 %>
  <% end %>
<% end %>

Classic AJAX version (using other autocomplete plugin)

<% semantic_form_for @user do |form| %>
  <% form.inputs do %>
    <%= form.input :name, :as => :autocomplete, :url => autocomplete_task_name_path() %>
  <% end %>
<% end %>

Dependencies

You must have the formtastic gem added to your application + an autocomplete gem/plugin present and the :defaults javascript must be included in your layout.

Credits

Thanks to Paul Smith for the original idea

Found a Bug?

Please direct all queries to the issue tracker:

http://github.com/michelefranzin/formtastic_jrails_autocomplete/issues

References

1 Formtastic @ GitHub

2 JRails AutoComplete @ GitHub

Copyright

Copyright © 2010 Michele Franzin. See LICENSE for details.