Set Max Char to Content

Nilang I Patel
Data Modeling & Business Logic
In most of the cases, web contents are created with the help of structure and template. While creating web content with structure and template, we can't restrict user to enter data with specific length. In other word, out of the box, there is no such facility to restrict user to enter predefined number of characters for structure element. This app facilitate this feature.

This app is comprises of one 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">
<entry name="noOfCharacterAllowed"><![CDATA[100]]></entry>

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. 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.

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

1. Text
2. Text-Box
3. Tex-Area(HTML)

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.
Liferay is trademark of Liferay, Inc., Liferay International Limited and/or Liferay Affiliate, registered in the United States and/or other countries.
Release Summary and Release Notes
Version Change Log Supported Framework Versions Date Added
Liferay Portal 6.1 CE GA2+
Liferay Portal 6.1 EE GA2+
Nilang I Patel
Published Date
September 15, 2014
Supported Versions
Help & Support
Terms & Conditions

Installation Instructions

This is a Legacy App that is no longer available in the new App Marketplace. You are able to acquire it from your installed DXP or CE instance and install it by following the instructions below.

Acquiring this App through the legacy Liferay Portal Store

  1. Review app documentation for any specific installation instructions.
  2. Login to your Liferay Portal instance with administrative permissions.
  3. Navigate to the Control Panel, Marketplace (or Apps for 7.3 and prior), then Store.
  4. If needed, login to your Liferay.com account by choosing Sign In.
  5. Search for the app name in the Search dialog.
  6. Once the app is found, click on the app in the search results.
  7. On the app details page, choose to acquire the app by selecting the Free, Buy, or Trial button.
  8. Follow the instructions on the screen to complete the acquisition.

Installing this App through legacy Liferay Portal Purchased Apps

  1. After acquiring the app, login to your Liferay Portal instance with administrative permissions.
  2. Navigate to the Control Panel, Marketplace (or Apps for 7.3 and prior), then Purchased.
  3. If needed, login to your Liferay.com account by choosing Sign In.
  4. Click the Install button to install your app on your Liferay Portal instance.

See the legacy App Marketplace help documentation for more information.