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
Is there a recommended way of restricting input length? #169
Comments
I think you don't have to restrict input. What worked is just to show the remaining characters and when it's in a negative area you show a hint. Something like this: Look at this thread, it's quit interesting: https://ux.stackexchange.com/questions/13055/character-limits-on-fields-pros-and-cons-and-best-practices UX Max Input length for pellAppend automatically the counter element after the pell container. I have a more complicated version implemented, but here is my approach. Add a
in onChange of pell init
Give your
Please notice: When counting characters you cant count the HTML tags inside. If you do this the user gets crazy numbers. For this I used this line |
Thanks, for following up @simonfranzen. That thread is an interesting read. I also wound up doing something similar to your approach in the application I was working on. |
I am also looking for something like this to be implemented. I want to restrict the user from typing more than a number of characters. I have gone through the comments here and seems like I will also have to do make do with a hack. I request the author to implement this as a feature or provide more hooks, so a preventDefault() maybe called on the original event. |
@siva-bathula This type of feature will likely never be a part of pell's core code, which is designed to be as minimal as possible. This makes more sense as a plugin. |
I will make do with a hack. Thanks for responding. |
First off, thanks for creating such a simple, useful plugin!
I find myself needing to limit the length of text a user may enter into the pell editor. I'm tempted to tack on an event listener and call
preventDefault
on the event object if the length of the pell editor's value is longer than N. Though, that seems like a kludge and like I'm working against the editor.So, is there a recommended way of limiting the amount of text a user may enter into the pell editor? I'm looking at the source now and don't see any obvious solutions. Perhaps the event object could be passed to
settings.onChange
from withincontent.oninput
?The text was updated successfully, but these errors were encountered: