Below is a set of code that works well except for Safari and IE on the Mac.
First you can see that I have an input element where the type is text and onFocus it call buildElement.
<input name="password" id="password" value="Password" type="text" onFocus="buildElement()" class="regtextbox" size="10" maxlength="20"/>
Here you can see that I am going into the DOM and replacing the input element with a password type.
function buildElement() {
removeElement(document.getElementById("password"));
addElement();
}
function removeElement(obj) {
obj.parentNode.removeChild(obj)
}
function addElement() {
inputElement = document.createElement("input");
inputElement.setAttribute("name","password");
inputElement.setAttribute("id","password");
inputElement.setAttribute("value","");
inputElement.setAttribute("type","password");
inputElement.setAttribute("size","10");
document.getElementById("password-span").appendChild(inputElement);
// need to use className and maxLength instead of setAttribute to work in IE
document.getElementById("password").className = "regtextbox";
document.getElementById("password").maxLength = "20";
document.getElementById("password").focus();
// needs to be called twice to work in IE
document.getElementById("password").focus();
}
When you submit the form I then call the js below to validate the required data and Safari chokes on the test and I am assuming that it fails on the e.type != "password".
if (e.name == "password") {
field_name = SignInLang.PASSWORD;
if (e.value == '' || e.value == null || (e.value == SignInLang.PASSWORD && e.type != "password"))
error += "\n" + field_name;
}
I am not that familiar with Safari so I am not sure why this is happening. Does anyone know why it might be failing here? Or, does anyone know if Safari has a DOM viewer that I can install to see how it handles it?
First you can see that I have an input element where the type is text and onFocus it call buildElement.
<input name="password" id="password" value="Password" type="text" onFocus="buildElement()" class="regtextbox" size="10" maxlength="20"/>
Here you can see that I am going into the DOM and replacing the input element with a password type.
function buildElement() {
removeElement(document.getElementById("password"));
addElement();
}
function removeElement(obj) {
obj.parentNode.removeChild(obj)
}
function addElement() {
inputElement = document.createElement("input");
inputElement.setAttribute("name","password");
inputElement.setAttribute("id","password");
inputElement.setAttribute("value","");
inputElement.setAttribute("type","password");
inputElement.setAttribute("size","10");
document.getElementById("password-span").appendChild(inputElement);
// need to use className and maxLength instead of setAttribute to work in IE
document.getElementById("password").className = "regtextbox";
document.getElementById("password").maxLength = "20";
document.getElementById("password").focus();
// needs to be called twice to work in IE
document.getElementById("password").focus();
}
When you submit the form I then call the js below to validate the required data and Safari chokes on the test and I am assuming that it fails on the e.type != "password".
if (e.name == "password") {
field_name = SignInLang.PASSWORD;
if (e.value == '' || e.value == null || (e.value == SignInLang.PASSWORD && e.type != "password"))
error += "\n" + field_name;
}
I am not that familiar with Safari so I am not sure why this is happening. Does anyone know why it might be failing here? Or, does anyone know if Safari has a DOM viewer that I can install to see how it handles it?