I tried this for checking the mandatory fields, but I have a syntax error in line 8 and I don't know what it is.
function validateForm ()
{
var bMsg = false;
//loop through all pages in the form
for (var nPage=0; nPage<xfa.host.numPages; nPage++)
{
//loop through fields in the page
var oFields = xfa.layout.pageContent(nPage, “field”);
var nNodes = oFields.length;
for (var n=); n<nNodes; N++)
{
//if the field is required
if (oFields.item(n).validate.nullText==”error”)
{
restoreField(oFields.item(n));
if (oFields.item(n).rawValue==”” ||
oFields.item(n).rawValue==null)
{
highlightField(oFields.item(n));
bMsg = true;
}
}
}
}
if (bMsg)
{
xfa.hostmessageBox (“At least one required field is empty”);
return false;
}
return true:
}
function restoreField(fld)
{
var oFld = xfa.resolveNode(fld);
var uiFld.ui.resolveNode(“#textEdit#);
if (uiFld == null)
uiFld = oFld.ui.resolveNode(“#choiceList”);
if (uiFld != null) // only handles text field and list box
{
//restore the original white color
uiFld.border.presence = “visible”;
uiFld.border.fill.color.value = “255, 255, 255”;
}
}
function highlightField (fld)
{
var oFld = xfa.resolveNode(fld);
var uiFld = oFld.ui.resolveNode(“#textEdit”);
if (uiFld == null)
uiFld = oFld.ui.resolveNode(“#choiceList”);
if (uiFld != null) //only handles text field and list box
{
//restore the original white color
uiFld.border.presence = “visible”;
uiFld.border.fill.color.value = “255,255,128”;
}
}