From 0be43f7e95beaed93b2ac6ede7c814d8b9861d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Jurmanovi=C4=87?= Date: Sat, 19 Jun 2021 14:40:25 +0200 Subject: [PATCH] fixed submit validation --- src/components/app-form/AppFormElement.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/components/app-form/AppFormElement.ts b/src/components/app-form/AppFormElement.ts index 102ddea..e213aa5 100644 --- a/src/components/app-form/AppFormElement.ts +++ b/src/components/app-form/AppFormElement.ts @@ -36,7 +36,7 @@ class AppFormElement extends BaseComponentElement { public onSubmit = (e) => { e.preventDefault(); - if (!this.valid) { + if (!this.isValid) { return; } this.submitFunc?.(this.values); @@ -97,16 +97,6 @@ class AppFormElement extends BaseComponentElement { return formObject; }; - get valid() { - let _valid = 0; - this.inputField?.forEach((input) => { - if (input.required && (input.inp as HTMLSelectElement).value) { - _valid++; - } - }); - return _valid == this.inputField?.length; - } - elementConnected = (): void => { if (this.renderInput) { this.update();