I have searched a lot, but did not find anything useful, so I just ask. The context is Rails 2.3.x, the usual javascript libraries. I would like to reach the following:
- I would like to have something similar to
<%= text_field_with_auto_complete :recipe, :name %>
but on text editors:<%= text_editor_with_auto_complete :recipe, :description, '\w+\:\w+' %>
- It should be customizable (best by a reg-expression) when to start auto-complete. So instead of starting for the whole contents, I would like to start on
\w+\:\w+
which means: start calling auto-complete when a string is entered that starts with non-space characters followed by a ':' sign which is followed by non-space characters. - The replacement should be done only on the string that matches the reg-expression of course.
Do you know any solution that could be adapted to my needs?
What about using jquery ui autocomplete with custom search function. Assuming that your text-area's id is #birds:
Now you just still have to implement that search on server side...Perhaps you could adapt the search later on, to only transfer the word instead of the whole textarea value...
The answer of abstraktor gave me a good starting point, but there were some missing parts. So I developed an example on github: jquery-autocomplete-inner
Here is the complete source code of the example (no HTML), and some explanation:
/[\wäöüÄÖÜß]+$/
--> all german work characters).If you want to take a look, download the zip-file from the GitHup repository and start the local example under
examples/cities-local.html
.