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

I am working on creating a pdf form using Adobe X pro to in my job and looking to take a Starting Number and have it go up by one every time it is used does anyone know how I can do it? I am using Java Scripts for other thing in the form?

Guest
Mar 30, 2016 Mar 30, 2016

I am working on creating a pdf form using Adobe X pro  to  in my job and looking to take a Starting Number and have it go up by one every time it is used does anyone know how I can do it? I am using Java Scripts for other thing in the form?

TOPICS
Acrobat SDK and JavaScript , Windows
680
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

correct answers 1 Correct answer

Community Expert , Mar 31, 2016 Mar 31, 2016

- You can add the code that increments the value of the counter field to your existing code. For example, put it in the SetFieldValues function.

- Under the Properties of the drop-down field, in the Options tab, tick the box that says "Apply the selected value immediately".

Translate
Community Expert ,
Mar 30, 2016 Mar 30, 2016

Let's say the field is called Counter. Enter this code as a new script under Tools - JavaScripts - Document JavaScripts (call it "init", for example):

this.getField("Counter").value = Number(this.getField("Counter").value)+1;

If you don't want that number to be reset when the form is cleared, enter this line as well:

this.getField("Counter").defaultValue = this.getField("Counter").valueAsString;

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
Guest
Mar 31, 2016 Mar 31, 2016

TRY67 Thank you for your Suggestion I placed both lines in the same script and it does not appear to work . i have info being Filled out based on a drop down Choice . it is not clearing the number when i reset it based on the drop down but the  number is not increasing. also do you know how to change the form based on the dropdown choice without having to reset every time?

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 Expert ,
Mar 31, 2016 Mar 31, 2016

Check the JS Console (Ctrl+J) for error messages.

I don't quite understand what you mean about changing the form based on a dropdown choice.

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
Guest
Mar 31, 2016 Mar 31, 2016

on my form I am using the a dropdown to Populate the fields on the form via a Java Script (see below) . when I switch to the Blank Selection it reset the form using

if( event.willCommit ) {

    if(event.value == "") this.resetForm(["DeptContact","DeptEmail","DeptNumber"]); else SetFieldValues(event.value);

}

then using the Java Script below I am Populating some of the fields  to auto fill in based on my Choice from the drop down.  

// Place all pre-population data into a single data structure

var DeptData = { Accounting:{ contact: "Steala Damuni", email: "accounting@mycomp.com", deptnum: "cmp1234" }, Engineering:{ contact: "Frank N. Stien", email: "engineering@mycomp.com", deptnum: "eng1234" }, Marketing :{ contact: "Shelly Oughtbuks", email: "marketing@mycomp.com", deptnum: "mkt1234" }, ITSupport:{ contact: "Goah Wei", email: "it@mycomp.com", deptnum: "its1234" }};

function SetFieldValues(cDeptName) {

    // Populate fields with values from the Department Data Object

    this.getField("DeptContact").value = DeptData[cDeptName].contact;

    this.getField("DeptEmail").value = DeptData[cDeptName].email;

    this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;

}

I am trying to get the job # field to add one when I switch jobs and then also when switching from ( MASS_FAMILY_STATEMENTS to NORTHERN LIGHTS STATEMENTS   it to switch the data  with our having to Click on the Blank to Reset the Form

JOB FORM.gif

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 Expert ,
Mar 31, 2016 Mar 31, 2016

- You can add the code that increments the value of the counter field to your existing code. For example, put it in the SetFieldValues function.

- Under the Properties of the drop-down field, in the Options tab, tick the box that says "Apply the selected value immediately".

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
Guest
Mar 31, 2016 Mar 31, 2016
LATEST

Thanks that worked

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