I am trying to create a script function on a form so I can perform the same validation against multiple objects in a form. What I want to to is pass the name of the object into this function and then perform different actions against each object.
I'm happy with creating the function, passing in the values and doing what I need to against the objects but I can't work out what syntax should be there to dynamically reference each object that is passed to the function.
var sName = "xfa.form.Form.Form.sYourDetails.sFirstName.vFirstName";
var sName = "xfa.form.Form.Form.sYourDetails.sLastName.vFirstName";
When in doubt about an objects name, I will put a message box out (on the enter event) with this code:
when executed it will show me the Som Expression to get access to the object. When dealing with fields in repeating subforms it is the subform that holds the fields that has the occurance number in it (not the field). So in your case the object you want is:
I think the problem I had was that when I did CTRL Click on an object, the script showed xfa.resolvedNode instead of xfa.form.ResolveNode.
This meant I had tended to use either of the below means to reference objects in the majority of my scrips: xfa.form.Form.Form.sYourDetails.sFirstName.vFirstName
Using these I couldn't reference a specific instance or dynamically reference the objet name because I wasn't using resolveNode(s). I new I needed to us it, but it wasn't evaluating as mentioned above.
1. Why fo I need to reference the form dom in the resolveNode Expression?