Allow cardless form

This commit is contained in:
Florine W. Dekker 2022-11-20 22:23:43 +01:00
parent 6f15754c50
commit febc5d4189
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
1 changed files with 6 additions and 2 deletions

View File

@ -26,8 +26,12 @@ export function clearFormValidity(form: HTMLFormElement): void {
export function showMessageType(card: HTMLElement | HTMLFormElement,
message?: string,
type?: "error" | "info" | "success" | "warning"): void {
if (card instanceof HTMLFormElement)
card = $(`article[data-status-for="${card.id}"]`)!;
if (card instanceof HTMLFormElement) {
const formCard = $(`article[data-status-for="${card.id}"]`);
if (formCard == null) return;
card = formCard;
}
const output = $("output", card)!;
card.classList.remove("hidden", "error", "info", "success", "warning");