diff --git a/src/Squidex/app/features/content/pages/content/content-field.component.html b/src/Squidex/app/features/content/pages/content/content-field.component.html index b8adf3f69..802caaafd 100644 --- a/src/Squidex/app/features/content/pages/content/content-field.component.html +++ b/src/Squidex/app/features/content/pages/content/content-field.component.html @@ -31,7 +31,7 @@
@@ -60,6 +60,7 @@
diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.ts b/src/Squidex/app/features/content/pages/content/content-page.component.ts index d5fb781a9..2b4cf62a0 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-page.component.ts @@ -256,11 +256,25 @@ export class ContentPageComponent implements CanComponentDeactivate, OnDestroy, fieldForm.controls['iv'].setValue(fieldValue['iv'] === undefined ? null : fieldValue['iv']); } } - if (this.content.status === 'Archived') { this.contentForm.disable(); } + } else { + for (const field of this.schema.fields) { + if (field.properties.hasOwnProperty('defaultValue')) { + const defaultValue = (field.properties as any).defaultValue; + if (defaultValue) { + const fieldForm = this.contentForm.get(field.name); + if (field.partitioning === 'language') { + for (let language of this.languages) { + fieldForm.controls[language.iso2Code].setValue(defaultValue); + } + } else { + fieldForm.controls['iv'].setValue(defaultValue); + } + } + } + } } } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/shared/services/schemas.service.ts b/src/Squidex/app/shared/services/schemas.service.ts index 730dccd5f..13cc9597a 100644 --- a/src/Squidex/app/shared/services/schemas.service.ts +++ b/src/Squidex/app/shared/services/schemas.service.ts @@ -426,7 +426,11 @@ export class NumberFieldPropertiesDto extends FieldPropertiesDto { } if (this.allowedValues && this.allowedValues.length > 0) { - validators.push(ValidatorsEx.validValues(this.allowedValues)); + if (this.isRequired && !isOptional) { + validators.push(ValidatorsEx.validValues(this.allowedValues)); + } else { + validators.push(ValidatorsEx.validValues(this.allowedValues.concat([null]))); + } } return validators;