Copy link to clipboard
Copied
I need to be able to auto tab through fields on a spawned page. I can get to work in Template, but when spawning it will only auto tab first three field then jumps to first page. Any help greatly appreciated.
Copy link to clipboard
Copied
Are you getting any error messages in the JavaScript console, use <Ctrl/Option> + J key to open the JavaScript console.?
Did you use the bRename property to rename the fields on the spawned pages?
This will prefix the field name on the template to include the "P#.[template name]." and the template's field name. One can extract the prefix form a renamed field by using the "split" method using the renamed field where your script is located by accessing that field's name, event.target.name, and applying the "split" method to make a string array from the field name when "." is used as the separator character. I would write this as a document level function since it will be used in many fields. The function will return either a null string if there are not enough levels within the field name to support the form field name and added prefix or the prefix elements if there are enough levels to support the renaming of the field. Such a function might be:
function GetPrefix(cName)
{
cPrefix = "";
aName = cName.split(".");
if(aName.length > 2)
{
cPrefix = aName[0] + "." + aName[1] + ".";
}
return cPrefix;
}
Copy link to clipboard
Copied
bRename is set to true
Copy link to clipboard
Copied
My Script:
var cPreFix = "";
// get prefix elements for spawned pages;
var aFieldName = event.target.name.split(".");
if(aFieldName.length > 2)
{
// first 2 elements of name array makeup the prefix for fields on a spawned page;
cPreFix = aFieldName[0] + "." + aFieldName[1] + ".";
}
function goNextAlpha(oItem, oEvent, cName, bAlpha)
{/*
*/
try{ // error catcher
if (bAlpha) {
if (AFMergeChange(oEvent).length == oEvent.target.charLimit) oItem.getField(cName).setFocus();
}
else {
AFNumber_Keystroke(0, 0, 0, 0, "",true);
}
if (oEvent.rc && AFMergeChange(oEvent).length == oEvent.target.charLimit) oItem.getField(cName).setFocus();
} catch(eMsg) { // trap error display error message, field in and next field
app.beep(3); // beep
} finally { // always run
return; }
} //end // goNext
My Keystroke:
goNextAlpha(this, event, cPreFix + "ls.1", true);
Copy link to clipboard
Copied
I figured it out, my solution was to insert Java into each field that I wanted to Tab and it looks like this.
var cPreFix = "";
// get prefix elements for spawned pages;
var aFieldName = event.target.name.split(".");
if(aFieldName.length > 2)
{
// first 2 elements of name array makeup the prefix for fields on a spawned page;
cPreFix = aFieldName[0] + "." + aFieldName[1] + ".";
}
Keystroke:
goNextAlpha(this, event, cPreFix + "ls.1", true);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now