required fields
This commit is contained in:
parent
a90cc514f0
commit
33de9c48eb
@ -31,7 +31,7 @@
|
|||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<textarea [mat-autosize] [matAutosizeMinRows]="3" matInput placeholder="{{'submission.text' | i18n}}"
|
<textarea [mat-autosize] [matAutosizeMinRows]="3" matInput placeholder="{{'submission.text' | i18n}}" [required]="entryType != 'LINK'"
|
||||||
formControlName="text"></textarea>
|
formControlName="text"></textarea>
|
||||||
<mat-error>
|
<mat-error>
|
||||||
{{'submission.text.error' | i18n}}
|
{{'submission.text.error' | i18n}}
|
||||||
|
@ -33,10 +33,15 @@ export class PageSubmission implements OnInit {
|
|||||||
|
|
||||||
this.form.get('entryType').valueChanges.subscribe((value) => {
|
this.form.get('entryType').valueChanges.subscribe((value) => {
|
||||||
this.entryType = value;
|
this.entryType = value;
|
||||||
if (value == 'LINK') {
|
switch (value) {
|
||||||
|
case 'LINK':
|
||||||
this.form.get('url').setValidators([ Validators.required ]);
|
this.form.get('url').setValidators([ Validators.required ]);
|
||||||
} else {
|
this.form.get('text').setValidators([ Validators.nullValidator ]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
this.form.get('url').setValidators([ Validators.nullValidator ]);
|
this.form.get('url').setValidators([ Validators.nullValidator ]);
|
||||||
|
this.form.get('text').setValidators([ Validators.required ]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user