Ability to change the "no existing match" label, and selecting it does nothing#216
Ability to change the "no existing match" label, and selecting it does nothing#216gfaraj wants to merge 1 commit intocrowdint:masterfrom
Conversation
… from updating if that item is selected
|
I like it. It would be nice to have the additional possibility to globally set the label though. |
|
I agree. I'll put it on my to-do list. Thanks. |
|
@gfaraj Because, I'm not using this input box only for the model related to auto-complete but also the columns in other tables, too. |
|
@megalomania1982 you would have to grab my changes since it hasn't been merged yet. No idea who controls that in this repo. If you get my changes, you could probably set the label text to an empty string, and that should be good enough for you. |
|
@gfaraj Thanks. but how can I grab your version? I have |
|
Nope, since it hasn't been merged to master you can't do that. You would have to manually replace the autocomplete-rails.js file that you have installed in your gem with the version in this pull request. |
|
@gfaraj Just replacing the whole content of one file??? which file and where is the content that my file has to be?? Sorry for this noob question. |
|
The file is autocomplete-rails.js. Run the following command: It will give you the path to the autocomplete gem you have installed. In its parent path there's assets/javascripts. That's where you need to replace autocomplete-rails.js. For example: This is the new content: Note: Make a backup of the original js file in case you want to go back to the old version. |
The input's value shouldn't be changed to "no existing match" if clicked, since it's not a valid item. I've fixed this.
Also, you can provide a "data-no-matches-label" attribute on the autocomplete input which specifies the text that will be shown if there are no matches.
<%= autocomplete_field_tag :user_name, '', autocomplete_user_name_users_path, :id_element => '#user_id', :data => { :no_matches_label => 'No matches found' } %>
For the future, we could have the label passed as a special hash value parameter.