I have created a huge button covering my whole PDF file. I want to fill it in white if the necessary fields in the PDF form are not filled in.(This is to prevent people from skipping required fields. My javascript code is listed below. I have initially filled in the button using Adobe Acrobat Pro, I am then trying to remove the button if the "year" field is completed.
var aNames = ["year"];
var bComplete = true;
var cValue ="";
for(i=0;i<aNames.length;i++){
cValue=this.getField(aNames[i]).value;
if(cValue==this.getField(aNames[i]).defaultValue){
bComplete=false;
}
}
if(bComplete==true){
document.getElementById("Button1").remove();
}else {
app.alert("Please complete form",0,0);
}