Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Auto Tab Next Field on spawned page

Community Beginner ,
Oct 11, 2016 Oct 11, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
288
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 11, 2016 Oct 11, 2016

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2016 Oct 11, 2016

bRename is set to true

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2016 Oct 11, 2016

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2016 Oct 11, 2016
LATEST

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines