0
Does anyone have an example where javascript is used to insert an action with creation of a button?
Community Beginner
,
/t5/acrobat-discussions/does-anyone-have-an-example-where-javascript-is-used-to-insert-an-action-with-creation-of-a-button/td-p/12637565
Jan 05, 2022
Jan 05, 2022
Copy link to clipboard
Copied
Working on a command that started from an example in Developing Acrobat Applications Using JavaScript and I modified it to look through fields of a form and if any page has a signature field and the field name is like “Performed” then place a button on that page. Got this working now and for the next iteration I would like to insert a lenghty java script or maybe make a custom function and would really appreciate any pointer or examples to modify last line of the example code given.
Thanks in advance for any help offered!
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i)
var f = this.getField(fname);
if (f.name==null || f.type=='button'||f.type=='radiobutton'||f.type=='text') continue;
if (f.type=='signature' && /Performed/.test(f.name))
// Make the buttons
var pp = addField("Button_", "button", f.page,[ 12, 100, 170, 68 ] );
pp.buttonSetCaption("Check & Sign Test Case");
pp.strokeColor = color.gray;
pp.borderStyle = border.b;
pp.linewidth = 11;
pp.fillColor=color.blue;
pp.textSize = 12;
pp.textColor = color.white;
pp.setAction("MouseUp", "Insert script here . . ;");
}
TOPICS
How to
,
JavaScript
,
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Have something to add?
Join the conversation

