Help With Code Adjustment for Print
I am trying to make my PDF form look for required fields that are blank and print the form as blank if the necessary fields are blank. It is possible that I'm making it more complicated than is necessary, however I'm a neophyte with JavaScript and this is what I've found so far.
Currently, the code that I have reads as:
(function () {
var i, val, bNotComplete = false;
var aFields = ["Sale Amount", "Office Refund Amount", "Office Credit Amount", "Client Name", "Client ID", "Ad Number", "Dispute Type", "Dispute Reason Text", "Office Dropdown1", "Office Dropdown2", "Dispute Notes", "Prepared By"];
for (i = 0; i < aFields.length; i += 1) {
val = getField(aFields).valueAsString;
if (!val) {
bNotComplete = true;
app.alert("Not all required fields are complete, so the form will print blank.", 3);
break;
}
}
for (i = 0; i < numFields; i += 1) {
getField(getNthFieldName(i)).display = bNotComplete ? display.noPrint : display.visible;
}
})();
This works perfectly, and I have so few fields on the form that typing them out specifically isn't a big deal. The problem that I'm running into is that some of the fields' visibility is dependent on a drop down selection and I need the code to disregard required fields that are hidden at print.
I tried to edit it myself with another code and create a kind of Franken-code, but that didn't work at all.
As I said before, I'm completely new at this, so any help that can be offered would be greatly appreciated!