Answered
Hello all,
I've been addicted to this forum while working on these forms, and while I've gotten very close with the other posts here, I still can't get my script to work, and I can't see how to debug it step by step to see where it's going wrong. Maybe you can help me.
I simply want to display a message when the form is printed that will notify the user of any required fields that are blank. I have the following code in the Document Will Print action:
var requiredFields = []; var j = 0; for (var i = 0; i < this.numFields; i++){ if (this.getField(this.getNthFieldName(i)).required){ requiredFields[j] = this.getField(this.getNthFieldName(i)); j++; } } var error = "Please complete the following fields: "; var msg = false; for (j=0; j < requiredFields.length; j++){ if (requiredFields[j].value == null){ error = error + requiredFields[j].name; msg = true; } } if (msg){ app.alert(error); fld.setFocus(); }
When I hit print, absolutely nothing happens. where am I going wrong?
You may also need to adjust your code for special field types like combo boxes, buttons, radio buttons, check boxes, etc.
George Kaiser