Skip to content

Commit 9e5e483

Browse files
committed
impr(input-validation): add trigger validation function
!nuf
1 parent 5050493 commit 9e5e483

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

frontend/src/ts/elements/input-validation.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export type ValidationOptions<T> = (T extends string
146146
export type ValidatedHtmlInputElement = HTMLInputElement & {
147147
isValid: () => boolean | undefined;
148148
setValue: (val: string | null) => void;
149+
triggerValidation: () => void;
149150
};
150151
/**
151152
* adds an 'InputIndicator` to the given `inputElement` and updates its status depending on the given validation
@@ -207,6 +208,9 @@ export function validateWithIndicator<T>(
207208
inputElement.dispatchEvent(new Event("input"));
208209
}
209210
};
211+
result.triggerValidation = () => {
212+
inputElement.dispatchEvent(new Event("input"));
213+
};
210214

211215
return result;
212216
}

0 commit comments

Comments
 (0)