crowdint/rails3-jquery-autocomplete — Issue #106: formtastic input_html: option not being processed properly
Author: chetstone
Created: 2011-10-13 20:03:45+00:00
State: open

I am using the :update_data_elements option to write to an additional form element. I think I should be using the formtastic input_html: option for this, but formtastic, instead of extracting the contents of :input_html, just jams the entire expression in the field as an input_html attribute.

This is how I think I should do it:

= semantic_form_for @remedy do |f|
= f.inputs do
= f.input :full_name, :as => :autocomplete, :url => autocomplete_abbreviation_name_remedies_path, :input_html => {:update_elements => {:abbr => '#remedy_name'}}

This produces the following html:
``

I also tried this:

= f.input :full_name, :as => :autocomplete, :url => autocomplete_abbreviation_name_remedies_path, :update_elements => {:abbr => '#remedy_name'}

and then I get the error `uninitialized constant ActionView::Helpers::JSON`

This workaround seems to work:

- json = ActiveSupport::JSON.encode( :abbr => "#remedy_name" )
= f.input :full_name, 'data-update-elements' => json, :as => :autocomplete, :url => autocomplete_abbreviation_name_remedies_path

Versions:
formtastic (1.2.4)
rails3-jquery-autocomplete (1.0.4)
rails (3.0.6)