Dear all,
I''m trying to get a field to autocomplete using auto_complete_for. I
have a database table "states" containing the data in a field name
"name". However it just does not show the list. Can anybody help ?
I''m
pretty new to rails. Here is my code:
/state/index.rhtml:
<script src="javascripts/prototype.js"
type="text/javascript"></
script>
<script src="javascripts/scriptaculous.js"
type="text/javascript"></
script>
Just a little test:
<%= text_field_with_auto_complete :state, :name %>
/controller/state_controller.rb
class StateController < ApplicationController
auto_complete_for :state, :name
end
/db/schema.rb
ActiveRecord::Schema.define(:version => 0) do
create_table "states", :force => true do |t|
t.column "name", :string, :limit => 20
end
end
Thanks,
Nick,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
jeansebastien.ney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-27 16:06 UTC
Re: Can''t get auto_complete_for example to work
Hello, Try with :states instead of the singular :state. On 27 fév, 03:27, "Nick" <nhi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Dear all, > > I''m trying to get a field to autocomplete using auto_complete_for. I > have a database table "states" containing the data in a field name > "name". However it just does not show the list. Can anybody help ? I''m > pretty new to rails. Here is my code: > > /state/index.rhtml: > > <script src="javascripts/prototype.js" type="text/javascript"></ > script> > <script src="javascripts/scriptaculous.js" type="text/javascript"></ > script> > > Just a little test: > <%= text_field_with_auto_complete :state, :name %> > > /controller/state_controller.rb > class StateController < ApplicationController > auto_complete_for :state, :name > end > > /db/schema.rb > ActiveRecord::Schema.define(:version => 0) do > create_table "states", :force => true do |t| > t.column "name", :string, :limit => 20 > end > end > > Thanks, > > Nick,--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Still doesn''t work.... On Feb 27, 11:06 am, "jeansebastien....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jeansebastien....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Try with :states instead of the singular :state. > > On 27 fév, 03:27, "Nick" <nhi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Dear all, > > > I''m trying to get a field to autocomplete using auto_complete_for. I > > have a database table "states" containing the data in a field name > > "name". However it just does not show the list. Can anybody help ? I''m > > pretty new to rails. Here is my code: > > > /state/index.rhtml: > > > <script src="javascripts/prototype.js" type="text/javascript"></ > > script> > > <script src="javascripts/scriptaculous.js" type="text/javascript"></ > > script> > > > Just a little test: > > <%= text_field_with_auto_complete :state, :name %> > > > /controller/state_controller.rb > > class StateController < ApplicationController > > auto_complete_for :state, :name > > end > > > /db/schema.rb > > ActiveRecord::Schema.define(:version => 0) do > > create_table "states", :force => true do |t| > > t.column "name", :string, :limit => 20 > > end > > end > > > Thanks, > > > Nick,--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---