-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twoCharLinebreak doesn't work in Firefox #113
Comments
Look a screenshot |
yes, confirmed, I am running the same issue: Chrome 48.0.2564.97 m, jQuery 2.2.0, Bootstrap 3.3.6 and latest Bootstrap Maxlength release from master branch. This is my setup:
Any advice @mimo84? Also I am using this for check how many characters a message has since this will be send through SMS and the limit is 160 for new phones and 140 for a few old phones (don't ask me why) so is there any chance to alert user when I reach 140 characters? |
I didn't have time to debug this bug unfortunately.. I'll try to look into it as soon as I have time. In the meanwhile do you have any ideas why this should have stopped working? |
@mimo84 well I think you miss a case when we mix special characters like in spanish languages ex: áéíóúñ or any other with line breaks. For example I am testing with this text:
And it allows 166 over 160. Here is a fiddle with the tests. Hope you have a time for look on this soon since I check the source but didn't found really where it fails |
This is a browser issue on how different browsers count newlines. Chrome counts them as 2 characters, while IE/Firefox count them as 1 character. The 2 char line break is working as it's counting them as 2 characters and is set to "true" by default: "twoCharLinebreak: true". What you are seeing as not working is the difference in how this plugin counts new lines vs how the browser counts them. The "validate" option by default is set to false, which falls back to the browser to limit the characters, which is going to allow you to go over what the counter says. To solve your issue, you need to set the "validate" option to true, which will force this library to limit the number of characters in your field:
|
How I can fix this?
The text was updated successfully, but these errors were encountered: