AEM Form Designer Check whole form for Empty Fields / Validation check
Sir / Madam,
I have made a form in AEM Designer in which i have all type of fields with subforms postioned / flowed ....
i want to add a button at the end to check if all the fields are filled , and if filled then according to the validations.
I found the below script on this forum.. it works fine.. but it doesnot work for Radio button & check boxes & for default value fields......
1. for Radio button instead of checking the Radio Group it checks each options inside the Radio group for emptiness
2. for checkbox if i have 20 it checks each of them but i want ..... say if out of 20 only 5 should be checked rest can be left blank
3. for defaultValue this script not working... it doesnot check the text field or any other field which has default value in it.... i want if any field has default value it should be shown in the error
Here is the script:
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).rawValue == null ||oFields.item(nNodeCount).rawValue == ""))
{
EmptyFields.push(oFields.item(nNodeCount).name);
}
}
}
if (EmptyFields.length>0) {
app.alert("Following fields are required. Please, fill in the following field(s):\n\n" + EmptyFields.join("\n"));
} else {app.alert("All Fields have been filled!!!");}