Javascript Radio Button app.alert
I have a pdf form that has required text fields and radio buttons. Once the user has filled out the form I've created a button that will check to see if all the required fields have been filled out, if yes then send an email, and then close the form without saving. If no, an app alert pops up and allows you to fill in the missing information. The app.alert works for the text fields but not the radio buttons. If the radio button is the only thing not filled out, I get the default error and then it skips the email portion and closes without saving the pdf. I have one set of radio buttons (qty of 3) called "group". Here is the JavaScript. Can someone please help.
var requiredFields = new Array();
for (var i = 0; i < this.numFields; i++)
{
var fName = this.getNthFieldName(i);
var f = this.getField(fName);
if (f.type!="button" && this.getField(fName).required && (this.getField(fName).value == null || this.getField(fName).value == ''))
{
requiredFields[requiredFields.length] = fName;}}
var error = "Please complete the following fields: \n\n";
for (j=0; j < requiredFields.length; j++)
{
if (requiredFields
{
error = error + requiredFields
var f2 = this.getField(requiredFields
f2.setFocus();
}
}
if (requiredFields.length > 0) {
app.alert(error);
} else {
this.submitForm ({
cURL:"mailto:none@none.com",
cSubmitAs: "PDF",
})
this.closeDoc(true);
}
