Avatar

Level 3

It's ok - I've sorted it!

Turns out that as my reqFieldsList was a string, the objects saved in there that I was trying to reference would have been strings, hence none of the commands I set for them would work.

I have now created an array - var reqFieldsArr = new Array();

Pushed each required field object into it - reqFieldsArr.push(requiredFieldObject);

Then looped through them at the end -

if

(reqFieldsArr != null)

{

    var counter = reqFieldsArr.length;

    var firstField;

    for (var f=0; f<counter; f++)

    {

          highlightErrors(reqFieldsArr[f]);

          if (f == 0)

          {firstField

= reqFieldsArr[f];}

    }

    xfa.host.messageBox('A number of mandatory fields have not been completed. Please check through the form and complete the highlighted fields');

    xfa.host.setFocus(firstField);

    return false;

}

else

{

return true;}

Might help someone else.....