$(document).ready(function () { $.getScript('https://localhost/Forms/js/jquery.mask.min.js', function () { //.DEMPIN, below, needs to be the field's CSS name, in the advanced tab $(".DEMPIN input").keyup(function () { //Retrieve the value var LogInChar = $(this).val(); $.trim(LogInChar); //Get The Length var pwdlength = (String(LogInChar).length); //Test for one character if (pwdlength > 1) LogInChar = Right(LogInChar, 1); //Test for a character var re = /[a-zA-Z0-9]/; if (LogInChar.search(re) != -1) { //Retrieve DPin //.DPin, below, needs to be the field's CSS name, in the advanced tab var PWD = $(".DPin input").val(); $.trim(PWD); //Add the returned character $(".DPin input").val(PWD + LogInChar); //Mask DemLogIn //Build the replacement value var DemMask = buildastrisks(pwdlength); // Change DemMask to astrisks $(".DEMPIN input").val(DemMask); } //Hide the DPin Field $(".DEMPIN input").blur(function () { $(".DPin input").hide(); }); //Clear the DPin Field $(".DEMPIN input").focus(function () { $(".DPin input").show(); $(".DPin input").val(""); $(".DEMPIN input").val(""); }); //Repeat the same code for Republicans here $(".REPPIN input").keyup(function () { //Retrieve the value var LogInChar = $(this).val(); $.trim(LogInChar); //Get The Length var pwdlength = (String(LogInChar).length); }); //Repeat the same code for Republicans here $(".REPPIN input").keyup(function () { //Retrieve the value var LogInChar = $(this).val(); $.trim(LogInChar); //Get The Length var pwdlength = (String(LogInChar).length); //Test for one character if (pwdlength > 1) LogInChar = Right(LogInChar, 1); //Test for any character var re = /[a-zA-Z0-9]/; if (LogInChar.search(re) != -1) { //Retrieve RPin //.RPin, below, needs to be the field's CSS name, in the advanced tab var PWD = $(".RPin input").val(); $.trim(PWD); //Add the returned character $(".RPin input").val(PWD + LogInChar); //Mask DemLogIn //Build the replacement value var DemMask = buildastrisks(pwdlength); // Change REPPIN to astrisks $(".REPPIN input").val(DemMask); } }); //Hide the RPin Field $(".REPPIN input").blur(function () { $(".RPin input").hide(); }); //Clear the RPin Field $(".REPPIN input").focus(function () { $(".RPin input").show(); $(".RPin input").val(""); $(".REPPIN input").val(""); }); // But don't go past here. //Begin Function //Usage: buildastrisks(Number of characters to return) function buildastrisks(n){ var str = "**********"; if (n > 10) return str; else { str = str.substring(0, n); return str; } } //End Function //Begin Function //Usage: Right(String, Number of characters to return) function Right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } //End Function }) }); });