Submitting input text (not selected from list)

rick's Avatar

rick

11 Dec, 2010 02:25 PM

Some people automatically start typing a word and click the submit button and don't wait to see if the word or partial word is in the results list. Can a user submit this text? If so, what is the name of its form field?

If not, seems like this would be an important feature to add.

  1. 1 Posted by TJ McKenzie on 19 Dec, 2010 06:03 AM

    TJ McKenzie's Avatar

    If a user types a word into the box and presses submit without adding it to the autosuggest list, either as an autosuggest selection or by pressing Tab or Comma to add it to the selections field, the data is easily available.

    Any data still remaining in the original input field will be passed as usual, and the name of that input field remains the same as you named it in the HTML.

  2. 2 Posted by John Welborn on 29 Nov, 2011 06:25 PM

    John Welborn's Avatar

    Try adding this code to the .blur() function after this line
    results_holder.hide(); It seems to do the trick for me.

    ` tab_press = true;

                        var i_input = input.val().replace(/(,)/g, "");
                        if (i_input != "" && values_input.val().search("," + i_input + ",") < 0 && i_input.length >= opts.minChars) {
                            var n_data = {};
                            n_data[opts.selectedItemProp] = i_input;
                            n_data[opts.selectedValuesProp] = i_input;
                            if ($(".active", results_holder).length == 0) {
                                var lis = $("li", selections_holder).length;
                                add_selected_item(n_data, "00" + (lis + 1));
                                if (timeout) { clearTimeout(timeout); }
                                timeout = setTimeout(function () { keyChange(); }, opts.keyDelay);
                            }
                            input.val("");
                        }
    

    `

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