Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7985437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:33:19+00:00 2026-06-04T11:33:19+00:00

http://loopj.com/jquery-tokeninput/ The code I am working with is from a jquery-tokeninput fork which allows

  • 0

http://loopj.com/jquery-tokeninput/

The code I am working with is from a jquery-tokeninput fork which allows multiple NEW tokens to be entered in the box (not just ones that already exist). The format of the string that it returns when they click submit is this:

16,42,'Subway',37,'McDonald\'s',734.

Those are ID numbers for the tokens that exist, and for ones that don’t exist it wraps them in ‘quotes’.

My question is how do I change my new_custom_tokens method to interpret whether they have entered a new token or not (check if its in quotes). Ultimately its going to check if their account is old enough to add new tags, and then I need to run Tag.new I assume (so it only saves it when their completely valid, including the resource validations)

EDIT: I also think i need some kind of validation that wont split things within quotes

resource.rb

  def tag_tokens=(tokens)
    self.tokens_list = tokens.split(",")

    if new_custom_tokens?
      custom_token_time_restriction
    else
      self.tag_ids = self.tokens_list
    end
  end


  def new_custom_tokens?
    if self.token_list ... #... not sure
  end


  def add_new_tag_time_restriction
    # TODO: Check if they are anonymous or their account is newer than 7 days
  end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:33:20+00:00Added an answer on June 4, 2026 at 11:33 am

    If I understood you correctly, this should do the trick:

    def new_custom_tokens?
      self.tokens_list.each { |token|
        return true if token.include? "'"
      }
      false
    end
    

    Basically it loops through the token_list array and returns true if any of the tokens have the ‘ character.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Jquery tokenizer as like facebook using the following plugin http://loopj.com/jquery-tokeninput/ which
Im trying to use the jquery tokeninput found here: http://loopj.com/jquery-tokeninput/ Following the guide from
http://www.leandrovieira.com/projects/jquery/lightbox/ sample so i have get images in while loop here is my code
Here is my code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js ></script> <script type=text/javascript > $(document).ready(function() { var
Hi i have this code right now on my website... <script src=http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js type=text/javascript charset=utf-8></script>
Hi I'm using JQuery tabs http://jqueryui.com/demos/tabs/ with search results being returned from my server
I'm trying to work with a jQuery script I found at http://marcgrabanski.com/articles/scrollto-next-article-button-jquery that allows
im following the railscasts using jquery tokeninput http://railscasts.com/episodes/258-token-fields-revised in creating autocomplete tag tokens and
http://mindfulintegrations.com/signiacapital/accordian.php I am using Jquery Accordion UI and if you look at the above
I'm using tokenInput jquery plugin for autocomplete. This script is working fine <script type=text/javascript>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.