Displaying a character limit as a word count

Hi

I would like to display a character limit within a multi line text property as a word count, and I would like to display the remaining word count below the text box.

For example a field can contain a maximum of 250 words. I would set this as a character limit of 1600, but I would like the end user to see a word limit of 250 words, with the text displayed changing as the user types words into the field.
I would also like to display an error message which tells the user how far over the word count they are.

Does anyone have experience of configuring this?

Thank you

Hi Nicky,

You can add the character count to a multi line text box by clicking “Show Character Count” in the presentation menu of the presenter in page builder.

image

Currently we only support letter count not word-count.
The limit is shown below the box like so (16 / 250) and is taken from the data type, you will need to create a new data type with a new limit:

If word count is essential you could either create an idea or look to produce a custom presenter to do this job for you.

Another option would be to use a fragment validator that would show an error message when the limit of 250 words was exceeded.

Copy and paste this code into a new Fragment Validator and apply it to the field in question.

var value = fragment_presenter.get_value() ||'';
return (value.split(' ').length > 250) ? 'Limit of 250 words has been exceeded (' + value.split(' ').length + ' / 250)' : { valid: true, warning: value.split(' ').length + ' / 250 Word Limit' };

When you leave the field, the word limit will be expressed below.

Valid:

Invalid:

Let me know if you need any further assistance.

Thanks Adam, we’ll explore these options and see what works best for us.