Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Moja Walidacja hasla
kenny1987
post 15.05.2012, 11:13:08
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
!*!
post 15.05.2012, 12:38:19
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.


--------------------
Nie udzielam pomocy poprzez PW i nie mam GG.
Niektóre języki programowania, na przykład C# są znane z niezwykłej przenośności (kompatybilność ze wszystkimi wersjami Visty jest wiele warta).
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 8.07.2025 - 04:35