Hello I am working on a javascript that is suppose to test the password field. However I can’t seem to get it to work. Nothing bad happens the page loads but seems like the script isn’t working. Here is what I have written up so far. I want it to check for a Upper and lower case letter, a number and a non-regular expression. Lenght isn’t important just that it has one of each. Here is what I have written so far.
UPDDATE: Found a simplier way of writing the script. And I can get it to give me a alert whenever the password field is wrong. But I can’t get the true statements to work to where it will do the document button click.
var str= passwordFieldForm;
var patt=/[a-z]/g;
var patt2 = /[A-Z]/g;
var patt3 = /[0-9]/g;
var patt4 = /[~\!@#\$%\^&*_\-\+=`\|\\(\)\{\}\[\]:;"'<>,\.\?\/]/g;
var result=patt.test(str);
var result2=patt2.test(str);
var result3=patt3.test(str);
var result4=patt4.test(str);
if (!result)
alert("Needs a lowercase letter");
if (!result2)
alert("Needs a Uppercase Letter")
if (!result3)
alert("Needs a Number.")
if (!result4)
alert("Needs a special character")
if (result) && (result2) && (result3) && (result4) == true
document.getElementById("kioskform:broswerPasswordSubmit").click();
This might be a bit closer to what you want, I’ve not tested it, but it should be more in the right direction: