Browse Source
Merge pull request #177 from kwyss88/master
Allow Dropdown and Radio fields to be empty if they are not required
pull/158/head
Sebastian Stehle
9 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
2 deletions
-
src/Squidex/app/features/content/pages/content/content-page.component.ts
-
src/Squidex/app/shared/services/schemas.service.ts
|
|
|
@ -253,7 +253,7 @@ export class ContentPageComponent implements CanComponentDeactivate, OnDestroy, |
|
|
|
fieldForm.controls[language.iso2Code].setValue(fieldValue[language.iso2Code]); |
|
|
|
} |
|
|
|
} else { |
|
|
|
fieldForm.controls['iv'].setValue(fieldValue['iv']); |
|
|
|
fieldForm.controls['iv'].setValue(fieldValue['iv'] === undefined ? null : fieldValue['iv']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -378,7 +378,11 @@ export class StringFieldPropertiesDto 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; |
|
|
|
|