Skip to content

[DEFECT] Block Editor Character Limit Not Enforced on Save #34304

@Neehakethi

Description

@Neehakethi

Problem Statement

The charLimit field variable in Block Editor fields displays a visual warning when exceeded but does not prevent content from being saved, allowing users to save content that exceeds the configured character limit.

Steps to Reproduce

When a Block Editor field is configured with a charLimit field variable (e.g., charLimit=100), the editor correctly:

  • Displays the character count with the limit (e.g., "150/100 chars")
  • Shows the count in red when the limit is exceeded
  • Provides visual feedback to the user

However, the character limit is NOT enforced as a validation rule:

  • Users can save content that exceeds the character limit
  • No validation error is displayed
Screen.Recording.2026-01-14.at.1.31.51.PM.mov

Save button remains enabled

  1. Navigate to Content → Content Types
  2. Create or edit a Content Type
  3. Add/Edit a Block Editor field
  4. In the field configuration, add a Field Variable:
    • Key: charLimit
    • Value: 100
  5. Save and publish the Content Type

Testing

  1. Navigate to Content → Content Search
  2. Create new content using the Content Type from setup
  3. In the Block Editor field, type a paragraph with more than 100 characters
    • Example: "This is a test paragraph to exceed the character limit. I'm typing more and more text here to make sure we go over one hundred characters and see what happens when we try to save this content."
  4. Observe that the character counter at the bottom shows red text (e.g., "150/100 chars")
  5. Click Save or Save & Publish

Result

  • Content saves successfully ❌
  • No validation error is shown ❌
  • Content can be retrieved with 150+ characters ❌

Acceptance Criteria

When a Block Editor field has a charLimit field variable configured:

  1. Visual Feedback (Already Working ✅)

    • Character count should be displayed
    • Count should turn red when limit is exceeded
  2. Validation Enforcement (MISSING ❌)

    • Form should be marked as invalid when character limit is exceeded
    • Save button should be disabled or show validation error
    • User should see an error message: "Character limit exceeded. Maximum allowed: 100 characters"
    • Content should NOT be saved until character count is within the limit
  3. Consistent Behavior

    • Character limit validation should behave similarly to other field validators (required, regex, etc.)

dotCMS Version

Evergreen

Severity

Medium - Some functionality impacted

Links

https://dotcms.freshdesk.com/a/tickets/34985
https://dotcms.slack.com/archives/C08MDK1BYLF/p1768423056696419

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions