Skip to content

Conversation

@nielslyngsoe
Copy link
Member

Fixes #18817

With the aspect that this guides the deveoper to do it right via the UI.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds input validation constraints to the TextBox property editor's "Maximum allowed characters" configuration field. The change prevents developers from entering invalid values (outside the 1-512 range) through the UI, addressing issue #18817.

Key Changes

  • Added config array to the maxChars setting with min (1), max (512), and placeholder (512) constraints
  • Removed the description text that previously indicated "If empty, 512 character limit"

@AndyButland AndyButland changed the title TexBox: Data-type validation for max chars (fixes #18817) TextBox: Data-type validation for max chars (fixes #18817) Nov 15, 2025
Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can verify this corrects the issue on the client, and I've added an equivalent server-side validation to to protect against direct requests to the management API.

Can be verified by a request using the Swagger UI and manipulating the provided maxChars value , e.g. for an existing textbox date type to:

PUT /umbraco/management/api/v1/data-type/{id}
{
   "name":"Test Box (50 Chars)",
   "editorAlias":"Umbraco.TextBox",
   "editorUiAlias":"Umb.PropertyEditorUi.TextBox",
   "values":[
      {
         "alias":"maxChars",
         "value":50
      },
      {
         "alias":"inputType",
         "value":"text"
      }
   ]
}

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error "Microsoft.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated in table" during save

3 participants