{
"$schema": "../../schemas/code-crispies-module-schema.json",
"id": "html-forms-basic",
"title": "HTML Formulare",
"description": "Lerne, Formulare mit verschiedenen Eingabetypen zu erstellen",
"mode": "html",
"difficulty": "beginner",
"lessons": [
{
"id": "form-structure",
"title": "Formularstruktur",
"description": "Jedes Formular benötigt einen <form>-Wrapper. Innerhalb verwendest du <label> zur Beschreibung der Eingaben und <input> für die Dateneingabe.
Das for-Attribut bei Labels sollte mit der id der Eingaben übereinstimmen für bessere Zugänglichkeit.",
"task": "Erstelle ein Formular mit:
1. Einem <label> mit dem Text Name: und dem for=\"name\"-Attribut
2. Einem Text-<input> mit id=\"name\" und name=\"name\"-Attributen",
"previewHTML": "",
"previewBaseCSS": "body { font-family: system-ui; padding: 20px; } form { max-width: 300px; } label { display: block; margin-bottom: 5px; font-weight: 500; } input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }",
"sandboxCSS": "",
"initialCode": "",
"solution": "
Anmelden, 'Registrieren', 'Senden').",
"task": "Füge dem Formular einen Absende-Button mit dem Text Anmelden hinzu.",
"previewHTML": "",
"previewBaseCSS": "body { font-family: system-ui; padding: 20px; } form { max-width: 300px; } label { display: block; margin-top: 15px; margin-bottom: 5px; } label:first-child { margin-top: 0; } input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } button { width: 100%; margin-top: 20px; padding: 10px; background: #1976d2; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background: #1565c0; }",
"sandboxCSS": "",
"initialCode": "",
"solution": "",
"previewContainer": "preview-area",
"validations": [
{
"type": "element_exists",
"value": "button[type='submit'], input[type='submit']",
"message": "Füge einen Absende-Button zu deinem Formular hinzu"
},
{
"type": "element_text",
"value": { "selector": "button", "text": "Anmelden" },
"message": "Der Button sollte Anmelden anzeigen"
}
]
}
]
}