Is there a way to show and hide the password in the password field? I want to make an checkbox that will control whether it is, but I do not know how.
For example, changing the type of item? I have not found anything like this in the documentation.
Try the next:
SCRIPT:
formData = [{
type: "password" ,
name: "pass",
label: "Password:",
width: "150",
labelWidth: "150",
labelHeight: "14",
inputWidth: "150",
inputHeight: "18"
},{
type: "checkbox" ,
name: "chb",
label: "Checkbox",
width: "150",
labelWidth: "150",
labelHeight: "14"
}];
myForm = new dhtmlXForm("myForm", formData);
myForm.attachEvent("onChange", function(name, value, is_checked) {
checked = myForm.isItemChecked("chb");
if(checked == true){
myForm.getInput("pass").type = "text";
}
else{
myForm.getInput("pass").type = "password";
myForm.getInput("pass").focus();
}
});
BODY:
<div id="myForm" style="height:500px;"></div>
Thanks!