mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 14:18:08 +00:00
fixed submit validation
This commit is contained in:
@@ -36,7 +36,7 @@ class AppFormElement extends BaseComponentElement {
|
|||||||
|
|
||||||
public onSubmit = (e) => {
|
public onSubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!this.valid) {
|
if (!this.isValid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.submitFunc?.(this.values);
|
this.submitFunc?.(this.values);
|
||||||
@@ -97,16 +97,6 @@ class AppFormElement extends BaseComponentElement {
|
|||||||
return formObject;
|
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 => {
|
elementConnected = (): void => {
|
||||||
if (this.renderInput) {
|
if (this.renderInput) {
|
||||||
this.update();
|
this.update();
|
||||||
|
|||||||
Reference in New Issue
Block a user