ChronoForms8 - Set max character count in text area.

markenns 02 Feb, 2024
I looked through the posts but didn't see anything related to this. Please point me in the right direction:

Is there a way to set the maximum characters users can enter in a textarea? (e.g. 1,000 character, ~200 words)

And as an aside, is there a way to search this forum?
Max_admin 11 Feb, 2024
Answer
there is no built in feature, I may add it to a future update, but here is a quick snippet which you can add inside a Javascript view on your form page to do just that:

document.getElementById('textarea_id').addEventListener('input', function() {
    var maxLength = 1000;
    var currentLength = this.value.length;
    var remainingLength = maxLength - currentLength;
    
    // Update the character count display
    document.getElementById('charCount').textContent = remainingLength;
    
    // Truncate the value if it exceeds the maximum length
    if (currentLength > maxLength) {
        this.value = this.value.slice(0, maxLength);
    }
});

change "textarea_id" to the ID of your textarea element
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
markenns 13 Feb, 2024
1 Likes
Thank you for that. I'll give it a try.
pgrnycomdir 17 Jun, 2025

Max,

For those of us who don't know what you mean by putting "javascript inside the page" a feature for max character length would be nice.  It was in previous versions.  And also adding a 'count down' would be equally as cool!!

Thank you for your consideration to this suggestion.

Best regards,

Donna

You need to login to be able to post a reply.