-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Text inputs don't show the current character count / remaining number of allowed characters #2159
Comments
Does this mean that instead of, for example "Maximum length is 64" it would say "64 characters remaining" or something like that? And would go down by one with each character. |
Yes. The JavaScript code should also disable the standard browser behaviour of preventing/truncating input beyond the maximum length. It can do that by removing the HTML element's |
@Changaco |
The entry point is the call to |
Oof, I've been working on this but I just realized I had been getting the max length for the javascript code from the html Here's my javascript function for reference: $('input').on('input', function() {
var maxLength = $(this).attr('maxlength') - $(this).val().length;
var helpBlock = $(this).siblings('.help-block');
if (helpBlock.text().slice(0, maxLength.toString.length+1) == maxLength + 1){
helpBlock.text(function (index, value) {
return value.slice(maxLength.toString.length+1);
})
}
helpBlock.prepend(maxLength + ' ');
})
`` |
Whatever needs to be passed from the Python server-side code to the JavaScript client-side code can be put in To be clear, the |
This issue is about making our
<input>
and<textarea>
elements more dynamic by adding a little bit of client-side JavaScript. The static hintMaximum length is {0}.
should be automatically replaced by a dynamic hint.The text was updated successfully, but these errors were encountered: