Liferay App : Set Max Char Content . This app provides facility to define max allowed character for structure element during web content creation.
To know more about Web contents in Liferay, please refer following blogs.
I have created new Liferay App which provides this facility. This free app is available on Liferay Marketplace (App name is Set Max Char to Content)
Liferay App :- Set Max Char
You can download this free app from liferay market place :- Set Max Char
This app is comprises of one liferay hook. After deploying this app, if we want to restrict user to add specific length of data then we need to set number of allowed characters in meta data (called ‘noOfCharacterAllowed‘) of structur’s element.
For example, let say there is one element in structure called ‘component‘ and we want to set number of allowed characters to 100, then defined it in meta data as below
<dynamic-element name="component" type="text" index-type="" repeatable="false">
After defining number of allowed character in meta data, label like “Maximum 100 Characters are allowed” will be visible after each such element on web content creation screen as per below screenshot.
When user tries to save / publish web content, JS error message will be displayed for each such element where user had entered more than allowed characters as below screenshot
This way we can restrict number of allowed character dynamically and it is configurable through meta data.
Currently this feature is available to following types of elements
For element of type Text-Area(HTML), the data will be stored in form of HTML. The No of character will be counted after filtering all html tags by this element, so it will count no of character which is actually entered by user.
So try this app and give your vote and (positive) feedback to me. Add any comments / questions / queries in Liferay Marketplace.(You need to create Liferay Marketplace account before putting comment).
I would recommend looking at index page ‘A Complete Liferay Guide‘ to browse all topics about liferay.