Hello I am working on a javascript that is supposed to test the password field. Now I was able to get the the password field to work out and display a alert if none of the requirements are not being met. However the next problem lies in what to do now that the requirements are true. I wrote a true statement to check to see if it it would click the button on the form to enter in the password but so far I can’t seem to get it click the button. Any advice would be very welcomed and appreciated. Here is the code I have as of right now.
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();
The
ifstatement expects an expression between parentheses, i.e.:Also, there’s no need to explicitly compare the result against
true. If the expression evaluates totrue, its body will be executed, just like you used in the individualifs.