When one gets a return of a null value when trying to access a field it indicates that field cannot be found. This could be because of a misspelling, the deletion of a field, not creating a field and expecting it to be present. Using the getArray method will provide an array of all the children field objects below the parent field. This list does not need the last level to be a number so one can use letters, does not include missing names in a series, and can provide a count of the total number of children fields. Using this apporach one does not need to update the script when more fields are added or deleted. var oParentField = this.getField("txt"); if(oParentField == null) app.alert("Missing txt field", 1,0, "Field Error"); var aChildrenFields = oParentField.getArray(); console.show(); console.clear(); console.println("Number of children fields: " + aChildrenFields.length); for(var i = 0; i < aChildrenFields.length; i++){ console.println(i + " child name: " +aChildrenFields[i].name); }
... View more