You can split an input on a specific string to get the same field to autocomplete multiple times. One example where you might want to do this is in the case of tags: You have a field that should contain multiple tags, and you want to do an autocomplete after every comma + space (', ').
It's not documented in the
rails3-jquery-autocomplete README, but all you need to do is use the 'data-delimiter' attribute like this:
<%= f.label :category_tags %>
<%= f.autocomplete_field :category_tags, autocomplete_category_tag_title_library_assets_path, 'data-delimiter'=>', ' %>
Hopefully this helps you save a little time by allowing you to skip reading the implementation to find this detail.
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
Great find Sam, right on time for something I am beginning to implement just now.
Posted by skumar
on Jun 07, 2011 at 05:22 PM UTC - 6 hrs
Fantastic info Sam. I was literally struggling to get this functionality and I found your comment. Thanks a lot.
Posted by Nagarajan
on Jul 18, 2011 at 11:21 PM UTC - 6 hrs
Hey Dude,
Thanks a lot, after two hours thinking & googling, i got your blog link & it was very helpful & my issue got resolved :)
Thanks
Posted by Vijay Kumbhar
on Aug 04, 2011 at 09:52 AM UTC - 6 hrs
Glad to be of service!
Posted by
Sammy Larbi
on Aug 04, 2011 at 10:45 AM UTC - 6 hrs
Can you please tell me how to work with data-delimiter option with text_field tag with rails3 jquery autocomplete plugin?
Thanks in advance..
Posted by anusha
on Aug 30, 2013 at 07:31 AM UTC - 6 hrs
Anusha,
The example in the post illustrates how to do it. Can you explain a little more about what's going on?
I haven't used this plugin lately, but I'm willing to try to help if I can!
Sam
Posted by
Sammy Larbi
on Aug 30, 2013 at 12:45 PM UTC - 6 hrs
Leave a comment