I am getting unexpected results with jQuery-TokenInput pre_populated data-set changes.
I have followed the Railscasts - Token Fields and updated the necessary code with Railscasts - Token Fields Revised source code acc. to the newest Rails version.
My coffeescript code that handles the token search query is:
jQuery ->
$('#user_tracker_ids').tokenInput '/trackers.json'
prePopulate: $('#user_tracker_ids').data('load')
minChars: 3
hintText: "Type in name"
preventDuplicates : true
My Strange results are:
CASE 1: [Initial case][CORRECT]
When the token-field is empty i.e no pre-populated data, and I enter any no. of tokens, I get the ID's associated with the tokens at my server-side action, which is correct.CASE 2: [Ending case ][CORRECT]
When I remove all the ID's entered before i.e I remove all the pre-populated data, I get0
ids, which is also correct.- CASE 3: [Failing case][WRONG]
When there are already values in the token-input, and I update them, e.g add more tokens, remove some of the existing tokens, I only get the ID's of the token's that were added in the current edit session. Changes made to the pre-populated data in the query-tokenInput are not sent to the server-side action.
I'm sure I'm missing some nitty-gritty setting here, but I'm unable to find it and fix it.
If you need more info. to locate the issue, please let me know.