Javascript code to undo Javascript read only code when signature cleared
I have the following Javascript code to be able to auto populate date fields when a form is signed, and to make all fields, except siganture fields, when the form is signed. The problem I have is when I clear the triggering signature field, the form is still read only. Is there a string of script I can add to undo the read only script / make the form fillable/editable again when the triggering signature is cleared? :
// JavaScript code to add the date at signing time
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var signingTime = month +"/"+day+"/"+year //Modify into your preferred format
var f = this.getField("Date Signed"); //Modify the field name as necessary
f.value = signingTime;
//getField("Text_Field").readonly = true;... makes Text_Field a read only field
for(var i = 0; i < this.numFields; i++) {
var fieldName = this.getNthFieldName(i);
if (fieldName == "Print Form" ||
fieldName == "Submit Form" ||
fieldName == "Lock Form" ||
this.getField(fieldName).type == "signature")
{
//console.println(i+":no:"+fieldName);... used in the debugger
}
else {
//console.println(i+":"+fieldName);... used in the debugger
getField(fieldName).readonly = true;
}
}
Thank you in advance!
