jquery-tokeninput

jQuery-tokeninput failing: “term” is undefined?

╄→гoц情女王★ 提交于 2019-12-07 12:06:59
问题 In my rails application I am trying to use jquery-tokeninput. I have everything working - json response and all - but the script errors out when anything is typed into the tokenized field, complaining: TypeError: term is undefined --> return term.replace(regexp_special_chars, '\\$&'); Both jQuery as well as the tokeninput scripts are loaded. What could cause this? 回答1: It sounds like you might need to specify propertyToSearch. By default, Tokeninput looks for a "name" field, but if you don't

How To add a placeholder to jQuery Tokeninput?

本小妞迷上赌 提交于 2019-12-07 07:01:53
问题 How can I add a placeholder to a jQuery Tokeninput field? A normal placeholder attribute won't work in here. 回答1: I think the current version of tokenInput supports this: $(function() { $("#elementID").tokenInput("http://www.foo.com/bar", { placeholder: 'Place holder text...' }); 回答2: For a input like: <input type="text" id="myInput" /> You can do: $("#myInput").tokenInput("/scripts/myjson.js"); $("#token-input-myInput").attr("placeholder", "Type here"); When you use tokenInput, it changes

How to use jquery tokeninput in Rails?

浪子不回头ぞ 提交于 2019-12-07 04:22:16
问题 I'm trying to add a tokeninput jquery field in a form in my app that allows users to post status updates. I want users to be able to attach works (a separate model) to the status update. I'm using the act_as_taggable_on gem and my query specifies the tags context "works". However, the field will not load any search results. I actually have a second tokeninput field that allows users to attach tags to the status update, much like this website uses tags to attach to this issue ticket. It works

How To add a placeholder to jQuery Tokeninput?

半世苍凉 提交于 2019-12-05 17:57:08
How can I add a placeholder to a jQuery Tokeninput field? A normal placeholder attribute won't work in here. I think the current version of tokenInput supports this: $(function() { $("#elementID").tokenInput("http://www.foo.com/bar", { placeholder: 'Place holder text...' }); For a input like: <input type="text" id="myInput" /> You can do: $("#myInput").tokenInput("/scripts/myjson.js"); $("#token-input-myInput").attr("placeholder", "Type here"); When you use tokenInput, it changes your input's id to "token-input-XXX", where XXX is the previous id 来源: https://stackoverflow.com/questions/22876286

How to use jquery tokeninput in Rails?

前提是你 提交于 2019-12-05 08:24:14
I'm trying to add a tokeninput jquery field in a form in my app that allows users to post status updates. I want users to be able to attach works (a separate model) to the status update. I'm using the act_as_taggable_on gem and my query specifies the tags context "works". However, the field will not load any search results. I actually have a second tokeninput field that allows users to attach tags to the status update, much like this website uses tags to attach to this issue ticket. It works fine! I'm trying to mirror that functionality to specify the context to search the works model and I'm

Using jquery tokeninput and acts_as_taggable_on

被刻印的时光 ゝ 提交于 2019-12-04 13:56:35
问题 I've implemented the framework outlined in this post: How to use jquery-Tokeninput and Acts-as-taggable-on with some difficulty. This is working insofar as prepopulating with the appropriate theme and ajax search, but when I enter a new tag, it is immediately deleted when the text area loses focus. I'm not sure what I'm doing wrong. Here's some of my relevant code: User Model (does the tagging): class User < ActiveRecord::Base [...] # tagging acts_as_tagger Item Model (accepts a tag): class

jQuery Tokeninput add if not exists

喜夏-厌秋 提交于 2019-12-04 08:59:53
问题 I am in the process of writing a script that builds upon user input, I have some fields that its values need to be quired from the database, and if no entry found I want to add a new value so the next user will find it through autocomplete. I found this great looking & easy to implement jquery plugin called TokenInput, but it doesn't seem to accept entries that are not available in my database query. Here's the link for the plugin: http://loopj.com/jquery-tokeninput/demo.html Is there a

Jquery Token Input - allowCustomEntry not working

烂漫一生 提交于 2019-12-04 06:06:31
问题 I am using Jquery Token Input version 1.6.0. I would like to be able to enter custom entries into the token-input, but everytime I do so the form submits (I type a custom word and hit enter). Here is my code (in coffeescript): jQuery -> $('[id$=tag_list_tokens]').each -> el = $(this) el.tokenInput '/listings/tags.json', theme: 'facebook' minChars: 1 allowCustomEntry: true preventDuplicates: true prePopulate: el.data('load') allowFreeTagging: false Everything works fine except for the custom

Using jquery tokeninput and acts_as_taggable_on

假装没事ソ 提交于 2019-12-03 08:44:17
I've implemented the framework outlined in this post: How to use jquery-Tokeninput and Acts-as-taggable-on with some difficulty. This is working insofar as prepopulating with the appropriate theme and ajax search, but when I enter a new tag, it is immediately deleted when the text area loses focus. I'm not sure what I'm doing wrong. Here's some of my relevant code: User Model (does the tagging): class User < ActiveRecord::Base [...] # tagging acts_as_tagger Item Model (accepts a tag): class Item < ActiveRecord::Base attr_accessible :title, :tag_list #tagging functionality acts_as_taggable_on

Uncaught TypeError: Cannot use 'in' operator to search for '' in JSON string

爱⌒轻易说出口 提交于 2019-12-03 02:01:29
I've use token input in my website, and here's how I initialize the token input: $(document).ready(function () { var populateValue = document.getElementById('<%= hiddentokenPrePopulate.ClientID%>').value $("#<%= tokenEmployee.ClientID%>").tokenInput("../Employee/getEmployeeDetails.ashx", { deleteText: "X", theme: "facebook", preventDuplicates: true, tokenDelimiter: ";", minChars: 3, tokenLimit: 1, prePopulate: populateValue }); }); The script was stuck on this line: prePopulate: populateValue When I remove this line, there won't be any javascript error, but I need this as I need to pre