Expand my Community achievements bar.

Validation of multiple empty fields in dynamic form

Avatar

Level 1

Hi,

I have created multiple fields dynamic form consisting of both mandatory & optional fields. Since the mandatory fields are validated by default, I want to validate the optional fields while submitting as PDF document dynamically and prompt me to continue or discard the submission. Also validating each & every field is not valid option as my form contains more than 200 fields.

I have tried with the below script which I successfully used to lock the form but in validating the empty fields I have a problem. Although I populate all the fields in the form, still I receive the validation message. Can anybody help me out on this issue?

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
// Set the field property.
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if (oFields.item(nNodeCount).isNull = 1 && oFields.item(nNodeCount).length < 0){
xfa.host.messageBox("All the form fields are not completed, Do you want to continue","Field Validation", 2, 2);
break
}
}
}

Thanks,

Jay

0 Replies