Ok so I got the text field to populate a list of what I needed but I have a problem. When I select an item in Firefox, there''s 4 spaces that appear before it in the text field. In safari, nothing appears in the field after selecting. I saw reference to this problem while searching online but couldnt quite find a solution. My code is almost exactly whats in the scriptaculous example at http://demo.script.aculo.us/ajax/autocompleter_customized here it is: #controller def auto_complete_for_software_title auto_complete_responder_for_software params[:software][:title] end private def auto_complete_responder_for_software(value) @soft = Software.find(:all, :conditions => [ ''LOWER(title) LIKE ?'', value.downcase + ''%'' ], :order => ''title ASC'', :limit => 40) render :partial => ''software_list'' #view <%= text_field_with_auto_complete :software, :title, {}, :skip_style => true %> #partial <ul> <% for soft in @soft do -%> <li> <%=h soft.title %> </li> <% end -%> </ul> I tried alot of different things but nothing seems to be fixing it. Any help would be greatly appreciated. I''m almost there :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://ccpdz.sarl.tk 2008/4/10, Mark Mr <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > > Ok so I got the text field to populate a list of what I needed but I > have a problem. When I select an item in Firefox, there''s 4 spaces that > appear before it in the text field. In safari, nothing appears in the > field after selecting. I saw reference to this problem while searching > online but couldnt quite find a solution. My code is almost exactly > whats in the scriptaculous example at > http://demo.script.aculo.us/ajax/autocompleter_customized > > here it is: > > #controller > def auto_complete_for_software_title > auto_complete_responder_for_software params[:software][:title] > end > > private > def auto_complete_responder_for_software(value) > @soft = Software.find(:all, > :conditions => [ ''LOWER(title) LIKE ?'', > value.downcase + ''%'' ], > :order => ''title ASC'', > :limit => 40) > render :partial => ''software_list'' > > #view > <%= text_field_with_auto_complete :software, :title, {}, :skip_style => > true %> > > #partial > <ul> > <% for soft in @soft do -%> > <li> > <%=h soft.title %> > </li> > <% end -%> > </ul> > > I tried alot of different things but nothing seems to be fixing it. Any > help would be greatly appreciated. I''m almost there :) > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 10, 2008, at 15:54 , Mark Mr wrote:> Ok so I got the text field to populate a list of what I needed but I > have a problem. When I select an item in Firefox, there''s 4 spaces > that > appear before it in the text field. In safari, nothing appears in the > field after selecting. I saw reference to this problem while searching > online but couldnt quite find a solution. My code is almost exactly > whats in the scriptaculous example at > http://demo.script.aculo.us/ajax/autocompleter_customized > > here it is: > > #controller > def auto_complete_for_software_title > auto_complete_responder_for_software params[:software][:title] > end > > private > def auto_complete_responder_for_software(value) > @soft = Software.find(:all, > :conditions => [ ''LOWER(title) LIKE ?'', > value.downcase + ''%'' ], > :order => ''title ASC'', > :limit => 40) > render :partial => ''software_list'' > > #view > <%= text_field_with_auto_complete :software, :title, {}, :skip_style > => > true %> > > #partial > <ul> > <% for soft in @soft do -%> > <li> > <%=h soft.title %> > </li> > <% end -%> > </ul> > > I tried alot of different things but nothing seems to be fixing it. > Any > help would be greatly appreciated. I''m almost there :)Looks correct at first sight. Have you inspected the Ajax response with Firebug? Does it look right? -- fxn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Xavier Noria wrote:> On Apr 10, 2008, at 15:54 , Mark Mr wrote: > >> >> :order => ''title ASC'', >> <% for soft in @soft do -%> >> <li> >> <%=h soft.title %> >> </li> >> <% end -%> >> </ul> >> >> I tried alot of different things but nothing seems to be fixing it. >> Any >> help would be greatly appreciated. I''m almost there :) > > Looks correct at first sight. Have you inspected the Ajax response > with Firebug? Does it look right? > > -- fxnYeah, the Ajax response is the list of elements when you type something in such as <ul> <li> Windows XP Home </li> <li> Windows XP Pro </li> </ul> I just dont know why its not inputting the value properly into the text box. One thing i noticed is when I look at the html, the textbox looks like this <input id="software_title" type="text" size="30" name="software[title]" autocomplete="off"/> the autocomplete attribute is set to off, not sure if that has any significance to this though. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok I just figured it out if anyone else has this problem. Apparently you need to have the partial all on one line with no spaces between elements. Old partial: <ul> <% for soft in @soft do -%> <li> <%=h soft.title %> </li> <% end -%> </ul> New partial: <ul><% for soft in @soft do -%><li><%=h soft.title %></li><% end -%></ul> Now it works properly. :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 10, 2008, at 21:47 , Mark Mr wrote:> Ok I just figured it out if anyone else has this problem. Apparently > you > need to have the partial all on one line with no spaces between > elements. > > Old partial: > <ul> > <% for soft in @soft do -%> > <li> > <%=h soft.title %> > </li> > <% end -%> > </ul> > > > New partial: > <ul><% for soft in @soft do -%><li><%=h soft.title %></li><% end > -%></ul>I guess the problem then was the spaces between the opening <li> and the content. The spaces between LIs themselves and the ones between UL and LIs are ignored for certain. -- fxn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---