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

Trying to copy a buttong with an action on javascript but the action does not copy

New Here ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

The title itself.

Hello community, I have a button that let me choose betwen 3 types of texts. Depending on the text its what'll be shown with a stamp (Same stamp for any text). And this process repeat itself on all pages.

The problem is when I try to copy this button into another document the action does not come with it and when I copy the javascript and manually put it into the action the Stamp does not show, just the text.

 

Thanks in advance.

TOPICS
How to , JavaScript , PDF forms

Views

269

Translate

Translate

Report

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 Expert ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

Where is the script selecting the three types of texts from?

 

Is it from text field objects? Dropdown menus? listboxes? 

Votes

Translate

Translate

Report

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
New Here ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

LATEST

Its a dropdown option menu. Here, I think its better if I share the whole script.

try
{

var Opcion = app.popUpMenu(["Approval", "Test 1", "Test 2", "Test 3" ], "-", "Draft" );

console.println(Opcion);

var x_AP = "Draft";
if (Opcion=="Test 1" ||
    Opcion=="Test 2" ||
    Opcion=="Test 3")
{
 var x_AP = "Approval";
 var s = app.response( {cQuestion: "Format  : Day - Month - Year", cTitle: "Date of approval ( "+Opcion+" )"} );
 var d = util.scand("dd/mm/yy", s);
}   
this.removeField("Authorize");
for (var i=0; i < this.numPages; i++)
{
 var annots = this.getAnnots({ nPage:i });
 console.println(annots);
 if (annots != null)
 {
   for (var j = 0; j < annots.length; j++)
  annots[j].destroy();
 }
 var annot = this.addAnnot( {
 page: i,
 print: true,
 type: "Stamp",
 rect: [474.57, 0.37, 590.50, 46.88],
 name: "Approved",
 author: "Procedures",
 AP: x_AP
 });
 if (Opcion != "Draft")
 {
  var g = this.addField("Authorize", "text", i, [479.11, 21.73, 581.53, 9.07] );
  g.textSize= 5;
  g.alignment= "center";
  g.readonly = true;  
  }
}
if (Opcion != "Draft" &&
    Opcion != null)
 this.getField("Authorize").value =   
 Opcion + ": " +
 util.printd("dd", d) + " of " +
 util.printd("mmmm", d) + " of " +
 util.printd("yyyy", d);

}   
catch(e)
{
   app.alert(e);
}

 

Votes

Translate

Translate

Report

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