check token callback function

Jorge's Avatar

Jorge

25 Mar, 2010 08:24 AM

I think it also would be a nice feature having a callback function where you can check if the token is valid before adding it to the token list.

Thanks!!

  1. Support Staff 1 Posted by Drew Wilson on 25 Mar, 2010 04:13 PM

    Drew Wilson's Avatar

    Jorge,
    Use the "beforeRetrieve()" function to do that.

    Thanks!

    Drew

  2. 2 Posted by Jorge on 26 Mar, 2010 11:56 AM

    Jorge's Avatar

    But beforeRetrive() is called after every single key you press

    What i want to do is to check if the token is correct (f.i. e-mail address) after the user has finally entered it.

  3. Support Staff 3 Posted by Drew Wilson on 26 Mar, 2010 04:57 PM

    Drew Wilson's Avatar

    Gotcha.
    Use the "selectionAdded()" callback. It will do what you need. It passes you the element object once it has been added to the list. so you can the text if you need to.

    Thanks!
    Drew

  4. 4 Posted by Jorge on 29 Mar, 2010 07:02 AM

    Jorge's Avatar

    I was using that function to check the tokens.

    If the element is wrong I just showed an alert and deleted the element but... Is there any way to let the user edit the token instead of deleting?

    Thanks!

  5. Support Staff 5 Posted by Drew Wilson on 29 Mar, 2010 07:10 AM

    Drew Wilson's Avatar

    Currently no.
    I am not sure what your use-case is, but are you doing some sort of word matching?

  6. 6 Posted by Jorge on 29 Mar, 2010 07:37 AM

    Jorge's Avatar

    I'm using your plugin to enter email addresses. In this scenario I'd like to check that the tokens inserted by the user are well formatted e-mails.

    Using selectionAdded is what I'm doing now but If the user has a mistake in the e-mail I remove the whole element instead of letting them edit it.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac