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

Pasting overwrites button text if button is <input> instead of <button> #79

Closed bill-uncultured closed 9 years ago

bill-uncultured commented 9 years ago

This was part of bug #65, but that got closed when part of it was fixed. Still happens in 1.9.1, except for the case where the pasted text is the same length as the text fields.

When you paste into autotab input text fields, the text of the following button gets overwritten if: -The button is an rather than a

bill-uncultured commented 9 years ago

Here's a partial fix:

$ diff -u jquery.autotab.1.9.1.js jquery.autotab.1.9.1-bill.js 
--- jquery.autotab.1.9.1.js 2015-02-12 15:39:01.625321085 -0700
+++ jquery.autotab.1.9.1-bill.js    2015-02-12 15:38:26.128220692 -0700
@@ -691,7 +691,7 @@

                         var defaults = getSettings(e);

-                        if ($(e).prop('disabled') || $(e).prop('readonly')) {
+                        if ($(e).prop('disabled') || $(e).prop('readonly') || $(e).prop('type')=='button') {
                             $(e).trigger('autotab-next');

                             if (!settings.iOS) {
@@ -762,4 +762,4 @@
         return $(this).autotab('filter', defaults);
     };

-})(jQuery);
\ No newline at end of file
+})(jQuery);

But you probably want more cases, like line 543 in jquery.autotab.1.9.1.js:

                if (this.type === 'select-one' || this.type === 'select-multiple' || this.type === 'checkbox' || this.type === 'radio' || this.type === 'button' || this.type === 'submit' || this.type === 'range') {
Mathachew commented 9 years ago

Thanks for the info @bill-uncultured. I have a fix that I wanted to test more thoroughly before creating another release. Should be some time this week.

Mathachew commented 9 years ago

@bill-uncultured 1.9.2 is out and should fix this issue.

bill-uncultured commented 9 years ago

Fix confirmed. Thanks, Mathachew!