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

Setting a form field to auto fill based on another field

New Here ,
Aug 05, 2016 Aug 05, 2016

Copy link to clipboard

Copied

I am creating a scorecard to be used by my companies inside sales group.

I need to set the form so that if data is entered into one field, a specified number will automatically populate in another field.

Example:

IF a "Follow-Up Quote #" field is filled in THEN a 3 will automatically be entered in the corresponding "Pts" fiield

IF a "New Prospect - Customer" field is filled in THEN a 10 will automatically be entered in the corresponding "Pts" field

IF a "New Quote #" field is filled in THEN a 5 will automatically be entered in the correspondng "Pts" field

Sample Form below for visual

Capture.JPG

TOPICS
PDF forms

Views

134.5K

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

correct answers 1 Correct answer

Community Expert , Aug 05, 2016 Aug 05, 2016

You can use something like this as the custom calculation script of the Pts field:

event.value = (this.getField("NameOfOtherField").valueAsString=="") ? "" : 3;

Votes

Translate

Translate
replies 102 Replies 102
New Here ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

I am trying to write some script for a field in a PDF.  I would like the information in several fields to all populate into one field all together. 

I would like the Text 32 box to automatically start with a U and then the information that is entered in the fundcode, dept, projectgrants, program to all populate together after the U.  For the Account box I would like that entry to equal a letter and enter that at the end of the string in the Text32 box.  Ex.  if 1005 is entered in the account box, the letter S would populate at the end of the string in the Text 32 box. 

Would someone be able to guide me?

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
Engaged ,
Aug 20, 2018 Aug 20, 2018

Copy link to clipboard

Copied

This thread sound close to what I'm looking.  If anyone could help I'd be super grateful

I created a drop down list called 'Employee List' to auto populate to 2 different text fields, 'Employee Name/ID1' and 'Employee Status1', that part I've got.

When picking from the 'Employee List' and 'Regular' auto populates to the 'Employee Status1' the number '1' will auto populate to another text field named 'PayTypeStatus1'.  If 'Temp' auto populates to 'Employee Status' the no '2' will auto populate to 'PayTypeStatus2' etc

The other step involves a separate drop down list called 'Acting Rate'.  If an acting rate is picked it will need to override the Regular or Temp Status auto populated from 'Employee List' to say 'Acting', then 'Acting' will auto populate the number'11' to the 'PayTypeStatus' text field.

One more thing, if 'Auxiliary' auto populates to 'Employee Status' from the 'Employee List' the number 3 will auto populate to 'PayTypeStatus' BUT if an acting rate is chosen the status needs to stay '3', not '11' as described above.

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
Explorer ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

Capture.JPG

Dear Experts,

Needed your help. above the table when the quantity value comes with 0 the column will be color on "red".

here how to write the script code based on the condition in Adobe LiveCycle designer form calc or javascript.

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 ,
Oct 26, 2018 Oct 26, 2018

Copy link to clipboard

Copied

Hi all!

I am creating a form and need to auto fill a field based on a selection in another field. For example: If I select the Common Name from a drop down list, I need the Botanical Name to auto fill.

Any help would be greatly appreciated!

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
Community Expert ,
Oct 26, 2018 Oct 26, 2018

Copy link to clipboard

Copied

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 ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

I have a similar question with EllenBBC but the code doesn't seem to work for me. I have a field (Field 1) that auto calculates the sum of other fields. I would like to have a separate field that generates text according to the number in Field 1.

Field 1 will be calculated and the number can range from 0-40. I would like to text to be generated as

< 14 "Unsatisfactory"

15-22 "Below Requirement"

23-29 "Meets Requirements"

30-35 "Exceeds Requirements"

36-40 "Outstanding"

I tried to use answers above to modify it accordingly but it doesn't seem to work.

Thank you!

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

Post the code you used, please.

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 ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

var v = this.getField("Field 1").valueAsString; 

if (v=="") event.value = ""; 

else { 

    var score = Number(v); 

    if (score<14) event.value = "Unsatisfactory"; 

    else if (score>=15 && score<=22) event.value = "Below Requirements"; 

    else if (score>=23 && <=29) event.value = "Meets Requirement"; 

    else if (score>=30 && <=35) event.value = "Exceeds Requirement";

    else if (score>=36 && <=40) event.value = "Outstanding"

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

The code is fine. Where did you put it and what were the results? Did you check the JS Console (Ctrl+J) for error messages?

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 ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

I did "Actions", "Mouse up", and then "Run a JavaScript".

When I try to click "OK", the line "else if (score>=30 && <=35) event.value = "Exceeds Requirement"; shows an error.

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

No, that code should be used as the custom calculation script of the field where you want to display the result.

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

This code is intended for a calculation script, not a MouseUp script.

The code is missing a variable. Write the "if" like this

else if ((score>=30 && (score<=35)) event.value = "Exceeds Requirement";

this needs to be changed in several places.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

You're right, I missed that mistake. However, there's also a mistake in your code (the number of opening and closing brackets doesn't match). This is the correct version of the full thing:

var v = this.getField("Field 1").valueAsString;

if (v=="") event.value = "";

else {

    var score = Number(v);

    if (score<14) event.value = "Unsatisfactory";

    else if (score>=15 && score<=22) event.value = "Below Requirements";

    else if (score>=23 && score<=29) event.value = "Meets Requirement";

    else if (score>=30 && score<=35) event.value = "Exceeds Requirement";

    else if (score>=36 && score<=40) event.value = "Outstanding"

}

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 ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

Thank you! That worked brilliantly!

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 ,
Dec 27, 2018 Dec 27, 2018

Copy link to clipboard

Copied

Anyone know how I could set a code to automatically generate a specific number range:

For instance, if I have one variable that can range from 1-43 and another variable that can range from I-VI (I'd prefer to leave it in roman numerals), how can I create a table that would automatically populate "1-6" in a field or "57-71" depending on the two variables?  Because there is no mathematic relation between the two variables and the output, I figure I will have to manually insert all the results (which I do not mind) so long as I can get the field to auto-populate.

Thanks in advance.

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
Community Expert ,
Dec 27, 2018 Dec 27, 2018

Copy link to clipboard

Copied

Yes, you would need to do that. You can use something like this if-condition:

if (v1>=1 && v1<=43 && (v2=="I" || v2=="II" || v2=="III" || v2=="IV" || v2=="V" || v2=="VI")) ...

Edit: code fixed...

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
Community Expert ,
Dec 27, 2018 Dec 27, 2018

Copy link to clipboard

Copied

You can probably also find a generic JS function online to convert Roman numerals to regular numbers, or write one yourself...

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 ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

Thank you!! Now it works!

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 ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Hi,

I have a similar question. I'm creating a form needed for bungalowparks, and I need a dropdown menu that shows the name of a park. I want the next text field to automatically state what the adress is of the park in the dropdown menu but I can't figure out how to do that. Can someone please explain?

Thanks in advance!

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
Community Expert ,
Apr 25, 2019 Apr 25, 2019

Copy link to clipboard

Copied

Did you read this thread in full? The solutions provided here should be applicable to your situation as well.

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 ,
May 15, 2019 May 15, 2019

Copy link to clipboard

Copied

Could someone help me with this. I have a .pdf form (using Adobe Acrobat Pro DC) that I created that has 7 checkboxes. I found the correct javascript to have other fields in the form to show or hide based on if the checkbox is checked or not. This document has two pages. The first page is set up more like a form; the second page is going to be used to generate a letter to a client. I would like to create text boxes that populate (page 2 - letter) based on what is checked in the checkmarks.

I have a checkbox one that when it is checked, it brings up 4 text boxes and a dropdown boxes for users to enter text in the text boxes and to choose 1 option from the drop down box. If the user checks checkbox 1, checkbox 2 and checkbox 3 and its corresponding text boxes or drop down boxes do not show on the form. The first half of the form consists of three check boxes and only one should be chosen. The second part of the form has 4 checkboxes and other boxes that the person can choose from more than one. I have managed to get the information to populate from page 1 to page 2 based on which check marks are chosen, but there may be a lot of wasted space in between those options (page 2) since some of the information doesn't need to populate over.

What I would like to do is have page 2 look more like a letter and have only the information that is checked from page 1 to flow over to page 2 (use text boxes that bring over information from the text boxes and dropdown boxes based on the checkmarks that are chosen. It doesn't matter that the 1st page has empty spaces between what is chosen, but since the 2nd page should look more like a letter, it does matter. Its ok for the first page to have dropdown boxes and checkboxes but the 2nd page should just have text boxes that are populated based on the fields chosen from the first page.

This is my javascript for the checkboxes to determine what other boxes get chosen on page 1.

var nHide = event.target.isBoxChecked(0)?display.visible:display.hidden;

this.getField("DD1").display = nHide;

this.getField("Text1").display = nHide;

this.getField("Text3").display = nHide;

this.getField("Text4").display = nHide;

var nHide = event.target.isBoxChecked(0)?display.hidden:display.visable;

this.getField("CB2").display = nHide;

this.getField ("Text5").display = nHide;

this.getField

("OR1").display = nHide;

this.getField ("CB2").display = nHide;

this.getField ("Text6").display = nHide;

this.getField ("OR2").display = nHide;

this.getField ("CB3").display = nHide;

this.getField ("Text7").display = nHide;

this.getField ("Text8").display = nHide;

That is working correctly.

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 ,
Jun 19, 2019 Jun 19, 2019

Copy link to clipboard

Copied

I am creating a form where I simply need one text field to equal the Negative of another text field. I am not sure how to make this happen. Help.

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 ,
Jul 12, 2019 Jul 12, 2019

Copy link to clipboard

Copied

I have a form used for status updates (law firm) where I'm trying to have one drop-down menu for which office the file is coming from (easy enough and already done)...Once chosen I need it to auto-fill the phone number for that specific selected office into another field.  In yet another field  I need another drop-down with all the employees in that specific office to populate and will be visible to select who is filling out the form.

The first part is easy, the other two I'm sure I can figure out over time but it seems like many of you are extremely knowledgeable and can help me quite a bit faster then me banging my head against the wall.

To clarify as well...I realize all of this can be done thru excel and then converted but was hoping to do it all thru the Prepare Form tab in Acrobat.  Thank you!

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
Community Expert ,
Jul 18, 2019 Jul 18, 2019

Copy link to clipboard

Copied

Post this question to a new thread

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Apr 13, 2020 Apr 13, 2020

Copy link to clipboard

Copied

Hi! 

in my form, based on the location value chosen from the dropdown titled "location" I want it to generate a specific email address in the "coordinator" field (for purposes of having the "submit" button generate a specific email address to send the form to based on what location is seleced). I'm a total noob so any siplified help would be awesome!!  

 

so if "Spain" is selected as location, I'd want xxxxxxx@gmail.com to generate in the coordinator field 

If "Prague" selected, I'd want possibly a different email to generate 

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