Adding a character counter on Custom Page Type fields

Matthew Hudock asked on September 3, 2021 15:48

Hi All,

As the title states I was just wondering if there was a relatively easy way to add a character counter to custom fields in various page types that we wish to restrict the max number of characters?

Thank you!

Recent Answers


Brian McKeiver answered on September 4, 2021 18:09

Unfortunately nothing out of the box or totally easy. However, with a little dev work you could make your own custom form control that does it. https://docs.xperience.io/custom-development/extending-the-administration-interface/developing-form-controls

3 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 6, 2021 09:47

The closest OOB functionality would be a validation rule that checks the number of characters on submit: Defining field validation rules. So, the field will accept only the number of characters set in the validation rule. f you want this to update the characters left as they type, you would have to use something like the examples and create a custom form control as mentioned by Brian above:
https://codepen.io/w3resource/pen/RjeYxQ
https://www.c-sharpcorner.com/blogs/how-to-count-character-of-textbox-in-asp-net1
https://forums.asp.net/t/2146743.aspx?counting+characters+in+a+textbox+using+javascript
https://forums.asp.net/t/2138540.aspx?Maxlength+Validation

1 votesVote for this answer Mark as a Correct answer

Matthew Hudock answered on September 7, 2021 14:33

Great! Thank you both for the responses, I will take these suggestions and give them a try!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.