Qustion about autocomplete

Hi

In a Rails application i use text_with_autocomplete helper.
My problem is in a Compose Message page :
Imagine a textfield, where i should type my email adresses : i can
type many emails separated by colon.

  • in the view : <%=text_field_with_auto_complete(“message”, “to”,
    {:size =>90}, :skip_style => true) %>
  • My controller action splits the received string that could be
    [email protected], yo’ , and does the search on the last string ‘yo’
  • The partial to show the list woould be then :

My problem is now to append/replace in my text field the current value
before autocompletion ( ‘[email protected], yo’ ) by :
Imagine the selected value from the drop down list is
[email protected]
I’d like to split the textfield value, and replace the second string
‘yo’ by ‘[email protected]’, to have as a final result in the
textfield : ‘[email protected], [email protected]

I tried :before_update_element but that doesn’t work

Any help would be appreciated

On Dec 15, 2007, at 12:04 PM, Laurent wrote:

In a Rails application i use text_with_autocomplete helper.
My problem is in a Compose Message page :
Imagine a textfield, where i should type my email adresses : i can
type many emails separated by colon.

  • in the view : <%=text_field_with_auto_complete(“message”, “to”,
    {:size =>90}, :skip_style => true) %>

Have a look at the :tokens option, see page 545 of the Agile.

– fxn

Ok fine it works… i didn’t remember it was supported… Thanks for
the pointer in the book…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs