How to return all selections?

Cameron Tinker's Avatar

Cameron Tinker

20 Dec, 2010 05:49 AM

Hi,

I am trying to find a way to get all objects in the selections returned from the AutoSuggest jQuery Plugin. I have an idea to add the objects to an array using the resultClick callback method, but then goes the question of removing the objects from the array if the user decides to delete a selection. Javascript doesn't allow for complex array manipulation with removing items at certain indices. Any advice on a simple way to achieve this? If there are any examples showing how to do this, please let me know. Thanks much!

  1. 1 Posted by Cameron Tinker on 20 Dec, 2010 06:51 AM

    Cameron Tinker's Avatar

    I ended up solving the question myself! I didn't realize that all I had to do was reference the hidden field that AutoSuggest already had created. For anyone interested, here's what I did:
    $("input.btnSubmit").click(function () {

                alert($("input[id$=as-values-messageto]").val());
                return false;
            });
    

    The id 'as-values-messageto' is a reference to the hidden field containing the selected items for the AutoSuggest Plugin. Note: messageto is just my asHtmlID. You can specify whatever you would like for that property.

    After you reference your hidden field, you can pass the values to your server side code for processing.

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