autocomplete in array

Experts,

have you figure it out with autocomplete to pass as array objects?

still i'm finding out the way to figure. :frowning:

regards,

Bala

Can you be more specific please? Perhaps with an example?

-- fxn

Fxn,

here is the situation,

my requirement is to send a mail to multiple contacts with different
autocomplete field, there i must need to place an array

but the actual code of view is for single data wil be <%=
text_field_with_auto_complete :contact, :name %> as single name

but i want as array

regards,

Bala

So you autocomplete a single string, and that string represents a set of contacts somehow? If that's correct are they kind of groups? Can you send something that identifies the group back to the server instead of an array of addresses?

-- fxn

here is the example of HTML

Contact One - <input type="text" name="contact_name[]"
id="contact_name1">
Contact Two - <input type="text" name="contact_name[]"
id="contact_name2">
Contact Three - <input type="text" name="contact_name[]"
id="contact_name3">

so here "contact_name[]" returns as array.

Same like this i want using autocomplete.

Just help this out Fxn, i've been try this for past a week. its being
an loads to my head

I see. There are two approaches.

One is to have a single text field that uses some token between names, for instance a commna. You configure that with the :tokens option.

The other one is to have a single text field per contact as in the example above. You can't have more than one text field with autocompletion in the same page due to conflicting HTML IDs, but there's a workaround here:

   http://blog.wolfman.com/articles/2006/10/17/having-multiple-text_field_with_auto_complete-in-the-same-view

-- fxn

Still couldnt get it i tried the example which you gave

Bala

Which example?

It would be useful to be more clear about what your code is actually doing. Please, write a single view with minimal HTML and a minimal controller/action to mimic what you want to accomplish. That is, reproduce the problem in isolated conditions until you get it right. If you can't get that minimal example to work, please send it and we we'll review it.

Just in case, before you try to solve the case for arrays be sure you understand how simple autocompletion works in Rails.

-- fxn

I have to concur, just saying "it doesn't work" is not very helpful.

The example in the blog works if implemented correctly, I use it all
the time.

You need to post more information about what the problem is before
anyone can help you.

Hi,

a helpful blog entry, thanks for the pointer.

BTW your link was truncated - should be:

http://blog.wolfman.com/articles/2006/10/17/having-multiple-text_field_with_auto_complete-in-the-same-view

tonypm