Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Define max characters in Structures (Liferay 7.1)
Hello everyone!
I'm trying to define a new template + structure to make the user able to create their own content. My goal is to let them put some text and images, and style them to be shown properly.
I want to set the maximum text for them to be able to introduce to 140 characters.
Is there a way to set it in the structure (I think this is where the solution can be ,but don't know how), template or article? Or when they're introducing data that the field got marked in some way (like a text appearing or the border of the field turning red, or something like this) if they surpass the max length.
Thank you in advance for your response!
I'm trying to define a new template + structure to make the user able to create their own content. My goal is to let them put some text and images, and style them to be shown properly.
I want to set the maximum text for them to be able to introduce to 140 characters.
Is there a way to set it in the structure (I think this is where the solution can be ,but don't know how), template or article? Or when they're introducing data that the field got marked in some way (like a text appearing or the border of the field turning red, or something like this) if they surpass the max length.
Thank you in advance for your response!
Hey Jordi,
Out of the box? pretty sure this is not an option. Having said that, there is a way you COULD add this, but it's not a "super clean" solution. I would be inclined to try it though to see if it works. 1. Create a new theme-contributor plugin: https://help.liferay.com/hc/en-us/articles/360018170951-Theme-Contributor- (7.0 reference but should still work in 7.1)
2. In your contributor add the JS that is used to register the on change event for the field. You should be able to get the field name from the page where the content is created.
3. Deploy.
Now, one thing to note is that this JS will now be loaded on every page of course because it's "global in nature" and not unique to any one given theme. In this case you are trying to do this in the control panel though so, short of making your own control panel theme I think this is a necessary evil. To be clear, I've never used this technique for something like this, but I have used it for a few other outlier type scenarios and it worked
Out of the box? pretty sure this is not an option. Having said that, there is a way you COULD add this, but it's not a "super clean" solution. I would be inclined to try it though to see if it works. 1. Create a new theme-contributor plugin: https://help.liferay.com/hc/en-us/articles/360018170951-Theme-Contributor- (7.0 reference but should still work in 7.1)
2. In your contributor add the JS that is used to register the on change event for the field. You should be able to get the field name from the page where the content is created.
3. Deploy.
Now, one thing to note is that this JS will now be loaded on every page of course because it's "global in nature" and not unique to any one given theme. In this case you are trying to do this in the control panel though so, short of making your own control panel theme I think this is a necessary evil. To be clear, I've never used this technique for something like this, but I have used it for a few other outlier type scenarios and it worked

Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™