0

I'd like Tokeninput to skip the help text and search for tokens right away.

I have a pretty short list of tokens, so I'd like to display them to the user, rather than have the user try and guess what are the right tokens to choose.

Seem's there's not an option for this so looks like I'll have to hack it?

Any hints as to what method I need to override and how?

ChrisJ
  • 2,486
  • 21
  • 40

1 Answers1

2

Line 195ish there's a show_dropdown_hint(), which is what you want to replace.

You'll need to replace it with populate_dropdown(query,results) and show_dropdown().

For the populate_dropdown() parameters, you should use an empty string for query - as that only relates to the section of the string which is bolded in the text, and results should be a JSON array (?) of all your tokens.

Not tested at all, but that's a rough guess, hope you can figure anything else out!

Chris
  • 5,882
  • 2
  • 32
  • 57
  • Thanks Chris will test that out in the next couple of days. – ChrisJ Oct 17 '13 at 05:47
  • 1
    That hit the spot, though I took a slightly different approach based on your advice: I altered `show_dropdown_hint()` to check if `settings.minChar` was 0, and if it was, to call `do_search()` instead of showing the hint. Then I altered `do_search()` so it didn't abort if there was no query. I've uploaded a fork to GitHub https://github.com/chrisjensen/jquery-tokeninput – ChrisJ Oct 25 '13 at 02:09