sequential number

Dec 22, 2018

Copy link to clipboard

Copied

i know absolutely nothing about java so be patient with me.

i have created a pdf work order that i would like to have generate a new work order number each time i open it.

i dont know where to start from . i have found some script examples but i dont know how to implement or place it to have the result show where i want it on the document.

any help would be greatly appreciated

TOPICS
Acrobat SDK and JavaScript

Views

377

Likes

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

sequential number

Dec 22, 2018

Copy link to clipboard

Copied

i know absolutely nothing about java so be patient with me.

i have created a pdf work order that i would like to have generate a new work order number each time i open it.

i dont know where to start from . i have found some script examples but i dont know how to implement or place it to have the result show where i want it on the document.

any help would be greatly appreciated

TOPICS
Acrobat SDK and JavaScript

Views

378

Likes

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
Dec 22, 2018 0
Dec 22, 2018

Copy link to clipboard

Copied

You can do it using a text field and a script.

What code did you find?

Likes

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
Reply
Loading...
Dec 22, 2018 0
Dec 22, 2018

Copy link to clipboard

Copied

this is the script i found, but having absolutely no knowledge of any kind of computer programming i dont even know where to input or how to do it.

trying to learn and do

thanks for the help and understanding

var f = this.getField("Tracking Number");
if (f.value=="") f.value = "0001";
else f.value = util.printf("%04d", (Number(f.value)+1));

Likes

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
Reply
Loading...
Dec 22, 2018 0
Dec 23, 2018

Copy link to clipboard

Copied

That code should work. You just need to create a text field called "Tracking Number" and then paste that code into the editor window under Tools - JavaScript - Document JavaScripts, under a new item (call it "scripts" for example). Make sure to overwrite all pre-existing code in that window, though.

Likes

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
Reply
Loading...
Dec 23, 2018 0
Dec 23, 2018

Copy link to clipboard

Copied

i have entered as you suggested but i am not getting any results.i have included images ,

script.PNGfield.PNGerror.PNG

Likes

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
Reply
Loading...
Dec 23, 2018 0
Dec 24, 2018

Copy link to clipboard

Copied

JavaScript is case-sensitive.

Likes

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
Reply
Loading...
Dec 24, 2018 1
Dec 24, 2018

Copy link to clipboard

Copied

lol. guilty of overlooking the simple because i convinced myself the answer was complex.

thank you for your help

Likes

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
Reply
Loading...
Dec 24, 2018 0
Apr 13, 2020

Copy link to clipboard

Copied

Hi,  I have a question,  I have entered the code and it works.   However, when you click on the number it rolls. Even after saving the form the  number rolls as well.  How do I keep the form number from rolling when the number is clicked on and after it is saved?

Likes

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
Reply
Loading...
Apr 13, 2020 0
Apr 13, 2020

Copy link to clipboard

Copied

The trick to solving a programming issue is to think through how you want it to work, write down the exact steps that are need to accomplish it, then ask us for suggestions on how to implement it.

 

The code presented here is designed to run each time the form is opened. If you want something different, the tell us how you want it to work. 

Likes

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
Reply
Loading...
Apr 13, 2020 0