See A Lesson in Template for an explanation of the naming convention.
It is possible when there is a defined naming convention that one can compute the names of fields once one gets any field that follows the naming convention. One can get the name of the of a field that has focus using "event.target.name". if this field was renamed as part of the spawning of the page, it will have 2 hierarchical levels of the format "P#." and "[template name]". So if one has a field name of "Amouint" on the template named "Invoice" and that template is used to spawn a new page after the first page of the form with the fields being renamed, the name for that field will be "P1.Invoice.Amount". Now usi
ng the "event.target.name" in say the calculation field, one use a script like:
// get the focused field name;
var cNameField = event.target.name;
to get the field's name. Now can split the nirearchical field name into an array using the "split()" method. Sincet each level of the name is seprated by a ".", using that character for the split method will create an array where each level of the name is a element in the array;
So we can now have the code:
// get the focused field name;
var cNameField = event.target.name;
// split the field name into an array;
var aNameField = cNameField.split(".");
// list the levels of the name field;
console.show();
console.clear);
for(var I = 0; I < aName.length; I++)
{
console.println(I + ": " +aNameField);
}
So the console should now display:
0: P1
1: Invoice
2: Amount
Element 0 of the array is the "P#" value and element 1 is the template name. With these values one can compute the name of any field renamed on that spawned page.