validation on web content fields ?

Hi everyone,

I would like to know if there is any OOTB (Out-of-the-Box) way in Liferay to add custom validation rules to Web Content fields without developing a custom OSGi module.

For example, I’m looking for ways to apply validations such as:

  1. Text length — minimum/maximum number of characters.
  2. Regex / pattern validation — e.g., allowing only specific formats.
  3. URL validation — ensuring that a field contains a valid URL or that the URL is accessible.
  4. Numeric validation — minimum/maximum values or specific numeric formats.

I’m aware that some basic field configurations provide validation options, but I’m specifically looking for a configuration-based that allows more advanced/custom validations without writing a custom OSGi module.

1 Answer

1

Hi @mahmoud.khalil,

The simplest suggestion here would be for you to investigate the new CMS capabilities. These are based on Objects, which support configurable (and extensible) validations out-of-the-box.

Web Content is part of the Classic CMS features, and, as you’ve determined, do not offer configurable validation features. It’s also worth noting that the Classic CMS features are in Maintenance mode, which means that no further capabilities will be developed.

Best regards,

Ben