Text string property editor: Data-type validation for max chars (fixes #18817)#20843
Text string property editor: Data-type validation for max chars (fixes #18817)#20843AndyButland merged 7 commits intomainfrom
Conversation
There was a problem hiding this comment.
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
configarray to themaxCharssetting with min (1), max (512), and placeholder (512) constraints - Removed the description text that previously indicated "If empty, 512 character limit"
src/Umbraco.Web.UI.Client/src/packages/property-editors/text-box/Umbraco.TextBox.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/property-editors/text-box/Umbraco.TextBox.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
I 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.
This 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"
}
]
}
src/Umbraco.Web.UI.Client/src/packages/property-editors/text-box/Umbraco.TextBox.ts
Show resolved
Hide resolved
Zeegaan
left a comment
There was a problem hiding this comment.
Back end looks good and works as intended, even got a little error in the backoffice 🚀
Fixes #18817
With the aspect that this guides the deveoper to do it right via the UI.