Witam, chciałbym przeprowadzić walidację formularza. Gdzie jest błąd, skrypt przepuszcza wszystko.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function validate()
{
function sprawdzEmail(){
f=document.nazwaform;
poz=f.Email.value.indexOf("@");
if (poz == -1) {
alert("Niepoprawny adres e-mail");
return false;
}
}
function sprawdzEmail(){
if (document.getElementById('login').length < 3)
{
alert('Podaj login');
document.getElementById('login').focus();
return false;
}
return true;
}
}
function send()
{
if (validate())
document.forms.nazwaform.submit();
}
{
function sprawdzEmail(){
f=document.nazwaform;
poz=f.Email.value.indexOf("@");
if (poz == -1) {
alert("Niepoprawny adres e-mail");
return false;
}
}
function sprawdzEmail(){
if (document.getElementById('login').length < 3)
{
alert('Podaj login');
document.getElementById('login').focus();
return false;
}
return true;
}
}
function send()
{
if (validate())
document.forms.nazwaform.submit();
}
1
2
3
4
5
2
3
4
5
<form method="post" action="skrypty/skrypt.klient_dodaj.php" name="nazwaform">
<input name="Wyslij" onsubmit="return send(this)" class="submit" type="submit" value="Zapisz"/> <input name="Czysc" class="submit" type="reset" value="Czyść"/>
<input name="Wyslij" onsubmit="return send(this)" class="submit" type="submit" value="Zapisz"/> <input name="Czysc" class="submit" type="reset" value="Czyść"/>





