Small improvement related to preFill and hidden input field

Ben Amada's Avatar

Ben Amada

27 Jan, 2011 04:16 AM

One "bug" or glitch I ran into is when using preFill. In the "selectionAdded" handler, I'm referencing the as-values hidden field. When you use the preFill option, it adds the option(s) and for each option added calls my selectionAdded handler ... BUT it does this before it has appended the as-values hidden input field to the page. This leads to my selectionAdded code failing as it expects the as-values hidden input field to be on the page.

There's a simple fix which is for the autoSuggest plugin to append the as-values hidden input field on the page as soon as the input field is created ... before the preFill code runs.

On approximately line 118 of the plugin code is:

input.after(values_input);

This should be moved to line 85. Line 84 is where the input field is first created:

var values_input = .........

After I did this, everything is working now that the hidden field is on the page as soon as possible. There's really no reason to delay appending the as-values hidden input field to the page.

Thanks... good plugin, btw.

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