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

maxlength="x" is replaced with maxlength="2147483647" #77

Closed dregre closed 9 years ago

dregre commented 9 years ago

I've noticed some funky behavior where certain text fields with pre-assigned maxlengths get those maxlengths re-assigned to an arbitrarily large number such as "2147483647." This has happened when using the global function $.autotab() as well as local functions .autotab()

Mathachew commented 9 years ago

@amgreg That's a change I introduced in 1.9.0 because of the way IE11 behaves with the ondrop event. When dropping text into the field, it should behave like a paste event and auto tab accordingly. The way I achieved this was to change the starting field's maxlength to 2147483647, that way I could capture all of the contents of the pasted text and handle it accordingly. That change to the maxlength property caused IE11 to throw a fit. My workaround, which I'll admit is probably shortsighted, was to change the maxlength from the start, while using the stored value that has always been captured during initialization of Autotab on a field.

Now that I've got the explanation out of the way, aside from seeing the maxlength changed, are you seeing any adverse effects? If the change is causing a problem, then I'm definitely going to revisit this.

dregre commented 9 years ago

Hum, interesting. Maybe detect whether is IE before changing the maxlength? I'm getting an issue where the textbox has its maximum length increased to 2147483647 such that autotab is never triggered. After some testing, I believe this happens (though I could be wrong), when the input field does not have a .next(). I'm using Chrome.

dregre commented 9 years ago

Btw, passing in {maxlength: x} does not resolve the issue.

patstuart commented 9 years ago

Are you seeing any adverse effects?

I'm no longer able to set the maximum length on a field, which is a deal-breaker for my project requirements. My temporary solution will be to remove the offending line of code (line 432) for our project, and just to let the paste not work in IE11.

Thanks again for your work on this.

Mathachew commented 9 years ago

Yeah that's a major problem. I really didn't think that change through. I will do my best to get a 1.9.1 patch out this week, but work's starting to get really busy and I can't make any promises. I'll update this when it's ready. Sorry about that!

Mathachew commented 9 years ago

I've just released 1.9.1, which rolls back the change of how maxlength is handled. IE11 is just going to have to do without drop support.