14. HTML forme

Čemu služi forma?

Kako izgleda forma?

<form action="/some_action_page.php">
  <label for="first_name">First name:</label><br>
  <input type="text" id="first_name" name="first_name" value="John"><br>
  <label for="last_name">Last name:</label><br>
  <input type="text" id="last_name" name="last_name" value="Doe"><br><br>
  <input type="submit" value="Send">
</form> 

Isprobaj taj kod u svom editoru

Form element

Atributi

Input element

type atribut

Primjer

Checkbox

Radio button

Placeholder vs. value

Validacije

Sto su to validacije?

Primjer

Pattern

min/max

Label

Cemu sluzi label?

Atributi

Primjer

Input kao button

Primjer

Button element

button vs. input type="submit"

submitting the form

Antonija pokazuje primjer

Zadatak

1. u svom index.html dokumentu napravi jedan form element

2. unutar forme dodaj dva input elementa

3. svakom input elementu dodaj label koji ce opisivati taj input

Select element

Primjer

Atributi

File

Primjer

textarea

Primjer

Zadatak

1. u svom html file napravi jednu formu koja ce imati:

2. action i method attribute

Action moze bit prazan

3. jedan select element s nekoliko optionsa

4. jedan file element

5. jednu textarea

sa ili bez cols i rows

6. ako je moguce, za svaki field u formi dodaj label

7. forma mora imati button koji submita formu

8. forma mora imati button koji resetira formu

Zadaća

Pogledaj video

Made with Slides.com