Mathachew / jquery-autotab

A jQuery plugin that provides auto tabbing and filtering on text fields in a form
http://autotab.mathachew.com/
366 stars 98 forks source link

Knockout and pasting text which spans multiple fields #82

Open delvesoftware opened 9 years ago

delvesoftware commented 9 years ago

I've got a few text input fields one after the other, the first one is 6 characters long, the second is 8 the third is 30 long.

If I paste some text that is 20 characters long into the first box AutoTab does a nice job of splitting the text into each of the boxes that follows. Awesome!

But when these fields are bound using Knockout the code in the 'drop paste' event causes Knockout to get a bit confused.

What's happening is Knockout is getting the event for the original 20 character text in the first field but not an event once that text is filtered to 6 characters, and this continues for the following fields.

I work around the issue by firing

$(e).trigger('input');

before each appropriate

$(e).trigger('autotab-next');

Which causes the knockout binding to relalise that the field has now changed since being filtered.

:-)

Mathachew commented 9 years ago

Sorry for the delayed response. Thanks for the info, I'll definitely look into this further.