Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Is it possible to limit the size of a text box by word count?

Avatar

Level 2

I know that it is possible to use a character limit but most users prefer a word limit as they feel it is a more meaningful restriction rather than punishing those that use long words!

Is there some way to apply a word count limit on a text field in Designer?

4 Replies

Avatar

Level 10

Hi,

I am flying by the seat of my pants on this...

If you converted the value of the textField to a string and then calculated the length of the string (.length) and then set the width of the textField to a multiple of the length (,w). The size of the multiple would depend on the font style and size, say 2mm (0.0787in) per character.

Probably more trouble than it is worth...

N.

Avatar

Level 2

Thanks Elaine, I did find a a few scripts like this online but none of them were geared toward people using LCD to create forms.  The one you've posted is the simplest one I've seen and  I've adapted the script form the example you provided but have had a blank on how to call the script object using a click event on a button.

So far I have

function countWords()

                       {

                       form1.test.countText.rawValue = form1.test.enterText.rawValue.split(' ').length;

                       }