London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Character limit for XhtmlString

Vote:
 

I'm wondering if it's possible to set a character (characters as in letters, no html elements or tags included) limit on a XhtmlString, and if yes, how can I do that? I found this thread from 2008, https://world.episerver.com/forum/developer-forum/Developer-to-developer/Thread-Container/2008/3/Char-limit-on-XHTML-string/ which suggests using a custom built function.

#198653
Nov 02, 2018 9:03
Vote:
 

Unfortunately that is not possible to do out of the box, and really hard to get right, I think. 

Some time ago I did however create a validation that displayed a warning to the editor when the text was possibly too long. I stripped out the html and counted the characters.

You can read more here:

http://www.jondjones.com/learn-episerver-cms/episerver-developers-guide/common-web-page-component-tutorials/how-to-return-different-validation-warnings-to-content-editors-when-publishing-content-in-episerver

https://world.episerver.com/blogs/Johan-Bjornfot/Dates1/2018/5/icontentsavevalidate/

https://world.episerver.com/documentation/class-library/?documentId=cms/11/CF0ACF14

#199066
Edited, Nov 14, 2018 14:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.