Community Expert
April 29, 2024
Answered
Zero = empty… Is it a new bug ?
- April 29, 2024
- 2 replies
- 484 views
Hi experts
I think I'm dealing with a new bug in Acrobat: JavaScript no longer knows the difference between nothing and zero.
Look at the attached file, there are three buttons, the top one tests if the value is equal to the default value, the middle one tests if the value is nothing and the bottom one tests if the value is zero.
In all cases the answer is the same, whether the fields contain zero or nothing.
Have I done something wrong or is this really a bug?
The scripts are in the buttons, this is the first one :
nCompteur = 0;
for (var i=0; i<this.numFields; i++) {
var oFld = this.getField(this.getNthFieldName(i));
if (oFld.type != "button" && oFld.required == true && oFld.value == oFld.defaultValue) {
oFld.strokeColor = color.red;
nCompteur = nCompteur + 1;
}
}
console.println("nCompteur = " +nCompteur);
if (nCompteur != 0) {app.alert({cMsg: "At least one field has not been filled in.\nFields that are not filled in are marked in red.", cTitle: "TITLE", nIcon: 1});}
else {app.alert({cMsg: "All fields are filled in", cTitle: "TITLE", nIcon: 1});}
Thank you

