Field Duplication from a spawned page to another page(s) -- both primary and spawned
So, I have a document that spawns two different template pages and am trying to have a field on the spawned page autopopulate a read-only field on one of the primary pages. I have attempted multiple variations garnered from the forums here with no success and a view from those who actually understand what they're doing would be greatly appreciated.
I am working under the assumption the script will have to run from the field on the spawned page and have placed the script (shared below) in the custom calculation script, custom validation, and javascript with no success.
//SNIPPET
var cPreFix = "";
var aFieldName = event.target.name.split(".");
if(aFieldName.length > 2)
{
cPreFix = aFieldName[0] + "." + aFieldName[1] + ".";
}
var sourceField = this.getField(cPreFix+"SR.Casualty.Description");
var targetField = this.getField("DISPLAY.Description");
if (sourceField && targetField) {
if (sourceField.valueAsString !== "") {
targetField.value = sourceField.value;
} else {
targetField.value = "";
}
}
