Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Moja Walidacja hasla
Forum PHP.pl > Forum > Po stronie przeglądarki
kenny1987
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
!*!
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.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.