From 33de9c48eb83dfad8f4c019ccce2cd9f5e6fb59a Mon Sep 17 00:00:00 2001 From: _Bastler Date: Wed, 6 Oct 2021 12:36:33 +0200 Subject: [PATCH] required fields --- src/app/pages/submission/submission.page.html | 2 +- src/app/pages/submission/submission.page.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/pages/submission/submission.page.html b/src/app/pages/submission/submission.page.html index 3da82c0..5d5e16d 100644 --- a/src/app/pages/submission/submission.page.html +++ b/src/app/pages/submission/submission.page.html @@ -31,7 +31,7 @@ - {{'submission.text.error' | i18n}} diff --git a/src/app/pages/submission/submission.page.ts b/src/app/pages/submission/submission.page.ts index d09d621..11dd841 100644 --- a/src/app/pages/submission/submission.page.ts +++ b/src/app/pages/submission/submission.page.ts @@ -33,10 +33,15 @@ export class PageSubmission implements OnInit { this.form.get('entryType').valueChanges.subscribe((value) => { this.entryType = value; - if (value == 'LINK') { - this.form.get('url').setValidators([ Validators.required ]); - } else { - this.form.get('url').setValidators([ Validators.nullValidator ]); + switch (value) { + case 'LINK': + this.form.get('url').setValidators([ Validators.required ]); + this.form.get('text').setValidators([ Validators.nullValidator ]); + break; + default: + this.form.get('url').setValidators([ Validators.nullValidator ]); + this.form.get('text').setValidators([ Validators.required ]); + break; } });