{ "$schema": "../../schemas/code-crispies-module-schema.json", "id": "html-forms-fieldset", "title": "Fieldset", "description": "Grupuj elementy formularza za pomocą fieldset i legend", "mode": "html", "difficulty": "beginner", "lessons": [ { "id": "fieldset-basic", "title": "Grupowanie z Fieldset", "description": "Element <fieldset> grupuje powiązane elementy formularza. Dodaj <legend> jako pierwsze dziecko, aby nadać grupie tytuł.

To pomaga w dostępności i wizualnej organizacji złożonych formularzy.", "task": "Utwórz formularz z fieldset:
1. Element <form>
2. Element <fieldset> wewnątrz
3. Element <legend> z tekstem Dane osobowe
4. Dwa opisane pola dla imienia i e-maila", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; background: #f0f4f8; } form { max-width: 400px; } fieldset { border: 2px solid #3498db; border-radius: 10px; padding: 20px; background: white; } legend { color: #3498db; font-weight: 600; padding: 0 10px; font-size: 1.1rem; } label { display: block; margin: 15px 0 5px; color: #333; font-weight: 500; } input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; box-sizing: border-box; } input:focus { outline: 2px solid #3498db; border-color: transparent; }", "sandboxCSS": "", "initialCode": "", "solution": "
\n
\n Personal Info\n \n \n \n \n
\n
", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "form", "message": "Dodaj element <form>" }, { "type": "element_exists", "value": "fieldset", "message": "Dodaj <fieldset> wewnątrz formularza" }, { "type": "element_exists", "value": "legend", "message": "Dodaj <legend> jako tytuł fieldset" }, { "type": "element_count", "value": { "selector": "label", "min": 2 }, "message": "Dodaj co najmniej 2 etykiety" }, { "type": "element_count", "value": { "selector": "input", "min": 2 }, "message": "Dodaj co najmniej 2 pola wprowadzania" } ] }, { "id": "fieldset-textarea", "title": "Dodawanie Textarea", "description": "Element <textarea> tworzy wieloliniowe pole tekstowe, idealne dla dłuższych treści jak wiadomości lub opisy.

Użyj atrybutów rows i cols aby ustawić domyślny rozmiar.", "task": "Utwórz formularz kontaktowy:
1. Element <fieldset> z <legend> Kontakt
2. Opisane <input> dla e-maila
3. Opisane <textarea> dla wiadomości
4. Przycisk <button> wysyłania", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; margin: 0; box-sizing: border-box; } form { max-width: 450px; margin: 0 auto; } fieldset { border: none; border-radius: 15px; padding: 30px; background: white; box-shadow: 0 10px 40px rgba(0,0,0,0.2); } legend { color: #667eea; font-weight: 700; padding: 0; font-size: 1.5rem; margin-bottom: 10px; } label { display: block; margin: 20px 0 8px; color: #333; font-weight: 500; } input, textarea { width: 100%; padding: 12px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 16px; box-sizing: border-box; font-family: inherit; } input:focus, textarea:focus { outline: none; border-color: #667eea; } textarea { resize: vertical; min-height: 100px; } button { margin-top: 20px; width: 100%; padding: 14px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; } button:hover { opacity: 0.9; }", "sandboxCSS": "", "initialCode": "", "solution": "
\n
\n Contact Us\n \n \n \n \n \n
\n
", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "fieldset", "message": "Dodaj element <fieldset>" }, { "type": "element_exists", "value": "legend", "message": "Dodaj element <legend>" }, { "type": "element_exists", "value": "textarea", "message": "Dodaj <textarea> dla wiadomości" }, { "type": "element_exists", "value": "button", "message": "Dodaj przycisk wysyłania" }, { "type": "element_exists", "value": "input", "message": "Dodaj pole dla e-maila" } ] }, { "id": "fieldset-multiple", "title": "Wiele Fieldsetów", "description": "Złożone formularze mogą używać wielu elementów <fieldset> do organizacji różnych sekcji.

To poprawia użyteczność długich formularzy jak rejestracja czy koszyk.", "task": "Utwórz formularz rejestracji z 2 fieldsetami:
1. Dane konta z polami nazwa użytkownika i hasło
2. Preferencje z textarea dla bio
3. Przycisk wysyłania poza fieldsetami", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; background: #fafafa; } form { max-width: 500px; } fieldset { border: 1px solid #ddd; border-radius: 10px; padding: 20px; margin-bottom: 20px; background: white; } legend { color: #2c3e50; font-weight: 600; padding: 0 10px; } label { display: block; margin: 15px 0 5px; color: #555; } input, textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; box-sizing: border-box; font-family: inherit; } input:focus, textarea:focus { outline: 2px solid #3498db; border-color: transparent; } textarea { resize: vertical; min-height: 80px; } button { width: 100%; padding: 14px; background: #2c3e50; color: white; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; } button:hover { background: #34495e; }", "sandboxCSS": "", "initialCode": "", "solution": "
\n
\n Account Info\n \n \n \n \n
\n
\n Preferences\n \n \n
\n \n
", "previewContainer": "preview-area", "validations": [ { "type": "element_count", "value": { "selector": "fieldset", "min": 2 }, "message": "Utwórz co najmniej 2 fieldsety" }, { "type": "element_count", "value": { "selector": "legend", "min": 2 }, "message": "Dodaj legend do każdego fieldseta" }, { "type": "element_exists", "value": "textarea", "message": "Dodaj textarea dla bio" }, { "type": "element_exists", "value": "button", "message": "Dodaj przycisk wysyłania" }, { "type": "element_count", "value": { "selector": "input", "min": 2 }, "message": "Dodaj co najmniej 2 pola wprowadzania" } ] } ] }