Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Moja Walidacja hasla
kenny1987
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 26.03.2012

Ostrzeżenie: (0%)
-----


Witam napisalem skrypt walidacji i nie dokonca wszystkie funkcje dzialaja

//Walidacja hasla
function blurenterpassword() {
var element = document.getElementById("enterpassword");
var wyrazenie = new RegExp([a-zA-Z0-9]);
if (element.value == ""){
document.getElementById("err_enterpassword").firstChild.nodeValue = "Pole Wymagane";
if (!element.value.match(wyrazenie) == NULL) {
document.getElementById("err_enterpassword").firstChild.nodeValue = "niepoprawny format hasla";
}
return false;
} else {
document.getElementById("err_enterpassword").firstChild.nodeValue = " ";
return true;
}
}
// Walidacja powtorzenia hasla
function blurretypepassword() {
var element = document.getElementById("retypepassword");
var haslo = document.getElementById("enterpassword");

if (element.value == ""){
document.getElementById("err_retypepassword").firstChild.nodeValue = "Pole Wymagane";
return false;
} else {
if(haslo.value != element.value ){
document.getElementById("err_retypepassword").firstChild.nodeValue = "Niepoprawne hasło";
return false;

} else {
document.getElementById("err_retypepassword").firstChild.nodeValue = " ";
return true;
}

}

}


Wyrazenie regularne nie dziala oraz chcialbym dopisac dlugosc hasla na min 6 znakow
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
!*!
post
Post #2





Grupa: Zarejestrowani
Postów: 4 298
Pomógł: 447
Dołączył: 16.11.2006

Ostrzeżenie: (0%)
-----


Wstaw kod w odpowiednie znaczniki i pokaż jakąś wersje live. W regex powinien być [a-zA-Z0-9]+ a ilość znaków sprawdzasz przy pomocy length.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 07:07