Created
October 14, 2012 03:47
-
-
Save jasonnoble/3887194 to your computer and use it in GitHub Desktop.
Problems with autocomplete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= simple_form_for [@user, @artist], :html => { :class => 'form-horizontal' } do |f| %> | |
| ... | |
| <%= f.input :zipcode_id, :label => 'Zip Code', :as => :autocomplete, :url => "/zipcode/autocomplete_zipcode_zipcode" %> | |
| ... | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://localhost:3000/zipcode/autocomplete_zipcode_zipcode?term=900 | |
| Returns: | |
| [{"id":"38037","label":"90001","value":"90001"},{"id":"38038","label":"90002","value":"90002"},{"id":"38039","label":"90003","value":"90003"},{"id":"38040","label":"90004","value":"90004"},{"id":"38041","label":"90005","value":"90005"},{"id":"38042","label":"90006","value":"90006"},{"id":"38043","label":"90007","value":"90007"},{"id":"38044","label":"90008","value":"90008"},{"id":"38045","label":"90009","value":"90009"},{"id":"38046","label":"90010","value":"90010"}] | |
| Then I select 90010 from the drop down list. | |
| This shows 90010 in the autocomplete field. I need the id field (38046) submitted with the form as zipcode_id. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment