liferay-ddm-field-validation

Implements and debugs DDM field validation rules in Liferay Document Types, Objects, and Forms.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/gweone/agent-plugins --skill liferay-ddm-field-validation-gweone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: liferay-ddm-field-validation
Source: https://github.com/gweone/agent-plugins/tree/main/plugin/sharpps-liferay/skills/liferay-ddm-field-validation
Command: npx skills add https://github.com/gweone/agent-plugins --skill liferay-ddm-field-validation-gweone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding or debugging validation on Liferay Dynamic Data Mapping (DDM) fields is confusing because there are two distinct mechanisms — declarative expression validation and custom OSGi validators — and it is unclear which one is server-side enforced, how they bind to fields, or whether Client Extensions can replace them. ## Core Features & Use Cases - Declarative expression validation: Configure customProperties.validation JSON on a field using DDM Expression Language functions like isEmailAddress(), matches(), or cross-field expressions, all enforced server-side by DDMFormValuesValidatorImpl. - Custom DDMValidation OSGi components: Create new named, reusable validators that appear in the Validation dropdown instance-wide, bound by data type with ranking support. - Boundary analysis: Confirms Client Extensions cannot hook DDM backend extension points, explains capture-phase submit interception for client-side-only blocking, and documents why dataRules show/hide logic is unavailable for Document Types. - Use Case: A developer needs email validation on a Document Type field that cannot be bypassed via REST API calls — the skill provides the verified JSON payload and confirms the backend enforcement path from portal source. ## Quick Start Add a server-side enforced email validation rule to the dt_owner_email field on my Liferay Document Type.

Frequently Asked Questions about liferay-ddm-field-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add validation to a Liferay DDM field?

Set the customProperties.validation JSON property on the field with a DDM Expression Language expression such as isEmailAddress(fieldName.value()) plus a localized errorMessage. This is converted into a DDMFormFieldValidation and enforced server-side by DDMFormValuesValidatorImpl.

How do I create a custom validator in the Liferay Validation dropdown?

Create an OSGi component implementing the DDMValidation interface with ddm.validation.data.type and ddm.validation.ranking properties. Its getTemplate() string becomes the validation expression, and it appears instance-wide on every field sharing that data type.

Is Liferay DDM field validation enforced server-side?

Yes, both declarative expression validation and custom DDMValidation components are enforced by DDMFormValuesValidatorImpl, the shared backend validator for Document Types, Objects, and Forms. Direct headless REST or JSONWS calls cannot bypass it.

Can Liferay Client Extensions add field validation?

No, no registered Client Extension type hooks into DDMValidation, DDMExpressionFunction, or other DDM backend extension points. A globalJS Client Extension can only add client-side UX or block the UI submit, which any direct API call bypasses.

Why is the Rules builder missing for Liferay Document Types?

DocumentLibraryDataLayoutBuilderDefinition inherits allowRules() as false, so the Rules sidebar panel is never rendered for Document Types; Journal also disables it explicitly. Only the standalone Forms app enables rules, and dataRules are evaluated entirely client-side anyway.

How do I make a Liferay field required only when another field has a value?

Express it as a validation expression on the dependent field itself, referencing the other field by name, so it stays backend-enforced. A dataRules setRequired action only affects the UI and never touches the field's static required flag checked by the server validator.