Hello All, We use a different custom form builder for our app, but I wanted to use facebooker''s typeahead widget in side the other form builder. I don''t know much about form builders, but I created a file in lib/ doing this: http://pastie.caboo.se/178776 It works great, except that the id''s and class names get messed up. Instead of school_name, I get nilClass_name. The other methods work fine however. Here''s the form: <h1>New School</h1> <%= show_flash %> <% af_form_for :school, :url => schools_path, :html => {:method => :post } do |f| %> <%= f.typeahead :name, @schools, "name", "name" %> <div class=''label''>School Type</div> <%= f.radio_button :type, "College", :label => "College/ University", :span => 4, :last => true %> <%= f.radio_button :type, "HighSchool", :label => "High School", :span => 4, :last => true %> <%= f.hidden_field :nid %> <%= f.submit "Create School" %> <% end -%> Anyone have an idea of what I''m missing here? Thanks, BJ Clark
I think @schools should be @school the form builder is looking for @school Dave On Thu, Apr 10, 2008 at 2:41 PM, BJ Clark <bjclark at scidept.com> wrote:> Hello All, > > We use a different custom form builder for our app, but I wanted to > use facebooker''s typeahead widget in side the other form builder. > I don''t know much about form builders, but I created a file in lib/ > doing this: > > http://pastie.caboo.se/178776 > > It works great, except that the id''s and class names get messed up. > Instead of school_name, I get nilClass_name. > The other methods work fine however. > > Here''s the form: > <h1>New School</h1> > <%= show_flash %> > <% af_form_for :school, :url => schools_path, :html => {:method > => :post } do |f| %> > <%= f.typeahead :name, @schools, "name", "name" %> > <div class=''label''>School Type</div> > <%= f.radio_button :type, "College", :label => "College/ > University", :span => 4, :last => true %> > <%= f.radio_button :type, "HighSchool", :label => "High > School", :span => 4, :last => true %> > <%= f.hidden_field :nid %> > <%= f.submit "Create School" %> > <% end -%> > > > > Anyone have an idea of what I''m missing here? > Thanks, > BJ Clark > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080410/5fe0439c/attachment.html
Dave, @schools is my collection of schools which I''m providing to populate the typeahead. @school is just a School.new. BJ On Apr 10, 2008, at 2:44 PM, David Clements wrote:> I think @schools should be @school the form builder is looking for > @school > > Dave > > On Thu, Apr 10, 2008 at 2:41 PM, BJ Clark <bjclark at scidept.com> wrote: > Hello All, > > We use a different custom form builder for our app, but I wanted to > use facebooker''s typeahead widget in side the other form builder. > I don''t know much about form builders, but I created a file in lib/ > doing this: > > http://pastie.caboo.se/178776 > > It works great, except that the id''s and class names get messed up. > Instead of school_name, I get nilClass_name. > The other methods work fine however. > > Here''s the form: > <h1>New School</h1> > <%= show_flash %> > <% af_form_for :school, :url => schools_path, :html => {:method > => :post } do |f| %> > <%= f.typeahead :name, @schools, "name", "name" %> > <div class=''label''>School Type</div> > <%= f.radio_button :type, "College", :label => "College/ > University", :span => 4, :last => true %> > <%= f.radio_button :type, "HighSchool", :label => "High > School", :span => 4, :last => true %> > <%= f.hidden_field :nid %> > <%= f.submit "Create School" %> > <% end -%> > > > > Anyone have an idea of what I''m missing here? > Thanks, > BJ Clark > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080410/f47117f5/attachment.html
Dave, The other form elements all get it correctly. "school_type, school_nid". That''s what has me so puzzled. BJ On Apr 10, 2008, at 2:57 PM, David Clements wrote:> Ah I see, sorry about that. I have a bug just like that recently. > You sure it is set? It seems like the nilClass is coming from the > form builder looking at the class of @school . Just a guess though. > > Dave > > On Thu, Apr 10, 2008 at 2:52 PM, BJ Clark <bjclark at scidept.com> wrote: > Dave, > @schools is my collection of schools which I''m providing to populate > the typeahead. @school is just a School.new. > BJ > > On Apr 10, 2008, at 2:44 PM, David Clements wrote: >> I think @schools should be @school the form builder is looking for >> @school >> >> Dave >> >> On Thu, Apr 10, 2008 at 2:41 PM, BJ Clark <bjclark at scidept.com> >> wrote: >> Hello All, >> >> We use a different custom form builder for our app, but I wanted to >> use facebooker''s typeahead widget in side the other form builder. >> I don''t know much about form builders, but I created a file in lib/ >> doing this: >> >> http://pastie.caboo.se/178776 >> >> It works great, except that the id''s and class names get messed up. >> Instead of school_name, I get nilClass_name. >> The other methods work fine however. >> >> Here''s the form: >> <h1>New School</h1> >> <%= show_flash %> >> <% af_form_for :school, :url => schools_path, :html => {:method >> => :post } do |f| %> >> <%= f.typeahead :name, @schools, "name", "name" %> >> <div class=''label''>School Type</div> >> <%= f.radio_button :type, "College", :label => "College/ >> University", :span => 4, :last => true %> >> <%= f.radio_button :type, "HighSchool", :label => "High >> School", :span => 4, :last => true %> >> <%= f.hidden_field :nid %> >> <%= f.submit "Create School" %> >> <% end -%> >> >> >> >> Anyone have an idea of what I''m missing here? >> Thanks, >> BJ Clark >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080410/46637eb9/attachment.html