I have the following code I found and tweaked for our purposes, however I am having difficulty modifying the code so that it only reports back all dropdown fields in my form, which are required, and have a default value, which is "0".
I've been playing with it, and I thought the current code would work, but it displays required fields as well as fields containing "0"
Can someone please help me out.
var EmptyFields= new Array();
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if ((oFields.item(nNodeCount).ui.oneOfChild.className != "button") && (oFields.item(nNodeCount).mandatory == "error" ||oFields.item(nNodeCount).rawValue == "0"))
{
EmptyFields.push(oFields.item(nNodeCount).name);
}
}
}
if (EmptyFields.length>0) {
app.alert("The first number indicates the Objective number** \n The second number indicates which score you missed. \n \n You have a zero rating in the Measuring Success section for the following ratings:\n\n" + EmptyFields.join("\n"));}
else
{
app.alert("All fields have been filled out successfully, and no errors were found.", 3)
}