The following code can be used to add a Password field to a content structure, including a Form.
Take the following steps to add a Password / Confirm Password field:
Once you save your field, add content to your content structure to test your new Custom Field. The value for the password entered will be added to the field $password.
<input type="password" name="myPasswordField1" id="myPasswordField1" value="$!password">
<br/>Confirm Password:
<input type="password" name="myPasswordField2" id="myPasswordField2" value="$!password" onChange="confirmPwdField('password')">
<script language="">
function confirmPwdField(field) {
var pwd1 = document.getElementById("myPasswordField1").value;
var pwd2 = document.getElementById("myPasswordField2").value;
if(pwd1 == pwd2){
document.getElementById(field).value = pwd1;
}else{
alert("Passwords don't match");
document.getElementById("myPasswordField1").focus();
}
}
</script>