Skip to main content

I had success in previous CMS tools where I could have a red character count shown to users after they started typing into a memo box of sorts.

Is there a way to display / show number of characters remaining in a textbox area?

 

If I set the max to 256 and it does a count down.

 

Thank you in advance!

Hi,


 


 


Perhaps this post might help.


https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Word-count-on-a-text-control/td-p/99327


 


That was for word count which started pointing me down a path that did get me what I needed.

The key that I missed was having the Script / Datalabel in the same cell as the Text Area.  Not sure if this is efficient or the right way to go but it did work.

 

I ended up having 2 data labels

1:   Name:  CharacterScript -  Literal / Holds expression

<Script language = "Javascript"> $(document).ready(function () { var wrdCountDataLabel = $("&name='CCount']"); wrdCountDataLabel.parent().find('input'type=text], textarea').keydown(function () { console.log($(this).val().length); $("&name='CCount']").html((256 - $(this).val().length) +"/256"); }); }); </Script>


*** The bolded item is populated with my 2nd datalabel that holds the text for the count.

 

2:   Name:  CCount


I would now LOVE to get conditional styling setup on that field that if the content is 0/256 the text is green else it is red. But can't seem to get that to work.


Reply