טפסים מתקדמים ב-HTML
טפסים הם חלק חשוב מכל אתר אינטרנט, והם מאפשרים למשתמשים להזין מידע ולשלוח אותו לשרת.
שדות קלט מתקדמים
ב-HTML ישנם סוגי שדות קלט שונים שמאפשרים לקבל סוגים שונים של נתונים מהמשתמש.
<form action="/submit" method="post">
<label for="email">אימייל:</label>
<input type="email" id="email" name="email" required>
<label for="password">סיסמה:</label>
<input type="password" id="password" name="password" required>
<label for="date">תאריך לידה:</label>
<input type="date" id="date" name="date">
<label for="color">בחר צבע:</label>
<input type="color" id="color" name="color">
<input type="submit" value="שלח">
</form>
כאן השתמשנו בשדות קלט מתקדמים כמו email
, password
, date
, ו-color
.
אלמנטים נוספים בטפסים
טפסים יכולים לכלול גם אלמנטים נוספים כמו תיבות סימון, תפריטים נפתחים וכפתורים רדיו.
<label>
<input type="checkbox" name="subscribe">
אני מסכים לקבל דואר אלקטרוני
</label>
<fieldset>
<legend>בחר את המין שלך</legend>
<label>
<input type="radio" name="gender" value="male">
זכר
</label>
<label>
<input type="radio" name="gender" value="female">
נקבה
</label>
</fieldset>
<label for="country">מדינה:</label>
<select id="country" name="country">
<option value="israel">ישראל</option>
<option value="usa">ארצות הברית</option>
</select>
השתמשנו בתגיות כמו checkbox
, radio
, ו-select
כדי להוסיף אפשרויות נוספות לטופס.