Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form with multiple inputs #45

Open
Aam-Do opened this issue Jun 29, 2023 · 1 comment
Open

Form with multiple inputs #45

Aam-Do opened this issue Jun 29, 2023 · 1 comment

Comments

@Aam-Do
Copy link

Aam-Do commented Jun 29, 2023

Wie kann ich ein Formular in eine Szene setzen (z.B. als novel page = Text) mit verschiedenen Inputs (nicht nur Buttons sondern Textinputs, Select, etc), auf dessen Submit warten und dann das Formular validieren und auswerten?

@JirkaDellOro
Copy link
Owner

Das kann man wahrscheinlich am besten mit Standard-Funktionalität umsetzen, ohne spezielle FudgeStory-Methoden.

Zum Testen habe ich den Dialog einfach in der HTML-Datei definiert.

    <dialog id="test">
      Test Dialog
      <button type="button">submit</button>
    </dialog>

Um Code öffne ich den Dialog, suche den Button und definiere eine Promise, die sich erfüllt, wenn der Button geklickt wird. Dann warte ich darauf und schließe am Ende den Dialog.

    let testDialog: HTMLDialogElement = document.querySelector("dialog#test");
    testDialog.showModal();
    await new Promise((_resolve) => {
      testDialog.querySelector("button").addEventListener("click", _resolve)
    });
    testDialog.close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants