Skip to content

Commit 83107bb

Browse files
Fix: #18421 - Added Max Length validation to PropertyTypeBasic Alias (#18427)
Co-authored-by: Daniel Nelson <[email protected]>
1 parent d499655 commit 83107bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Umbraco.Core/Models/ContentEditing/PropertyTypeBasic.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class PropertyTypeBasic
2525

2626
[Required]
2727
[RegularExpression(@"^([a-zA-Z]\w.*)$", ErrorMessage = "Invalid alias")]
28+
[MaxLength(255, ErrorMessage = "Alias is too long")]
2829
[DataMember(Name = "alias")]
2930
public string Alias { get; set; } = null!;
3031

src/Umbraco.Web.UI.Client/src/views/components/umb-locked-field.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
title="{{ngModel}}"
2626
focus-when="{{!locked}}"
2727
umb-select-when="{{!locked}}"
28-
ng-blur="lock()" />
28+
ng-blur="lock()"
29+
ng-maxlength="255" />
2930

3031
</div>
3132

@@ -46,6 +47,11 @@
4647
ng-if="serverValidationField.length > 0"
4748
ng-message="valServerField">{{lockedFieldForm.lockedField.errorMsg}}
4849
</div>
50+
<div class="umb-validation-label"
51+
ng-class="{ '-left': validationPosition === 'left', '-right': validationPosition === 'right' }"
52+
ng-if="ngModel.length > 255">
53+
<localize key="general_invalid">Invalid</localize> <localize key="content_alias">alias</localize>
54+
</div>
4955
</div>
5056

5157
</ng-form>

0 commit comments

Comments
 (0)