• 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

133.6K

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 ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

@try67 I have this some what working. My drop down menu has three rows of info, I would like to only pull the first seven characters into one text field "Service Order" and pull the very last eight characters into a seperate text field "comfirmation"  I would also like to add the middle info of the dropdwon into the "Description" text field. There is alot of variation amount of text in the middle of the drop down, but necessarily needed.

the code used in calculation 

event.value = this.getField("ORDER").value

service report 1.png

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 ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

You can use the substring method to achieve it. See: https://www.w3schools.com/jsref/jsref_substring.asp

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 Beginner ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Hello,

 

I was wiwondering if you could help. 

 

I have a field named "Minutes" I want field "Amount" to auto populate based on what number is entered in the minutes field.

 

Below is my criteria:

 

Minutes: ≥15 & <41    Amount: $20

Minutes: ≥41 & <81    Amount: $30

Minutes: ≥81               Amount: $45

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 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

You can use this code as the custom calculation script of the Amount field:

 

var minutes = Number(this.getField("Minutes").valueAsString);
if (minutes>=15 && minutes<41) event.value = 20;
else if (minutes>=41 && minutes<81) event.value = 30;
else if (minutes>=81) event.value = 45;
else event.value = "";

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 Beginner ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Thank you so much! It worked perfectly 🙂

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 ,
Aug 06, 2021 Aug 06, 2021

Copy link to clipboard

Copied

Hello,

 

I am hoping you can help with a problem I am having. 

 

I have two fields. One named Agency # and the other Agency Name. 

 

The user enters an agency # and I want the program to autofill the agency name based on the number that is inputted. I'm assuming I will have to put in each corresponjding agency name which is fine but I'm not sure of the code that I need to be using. 

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 ,
Aug 06, 2021 Aug 06, 2021

Copy link to clipboard

Copied

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

 

var agencyNumber = this.getField("Agency #").valusAsString;
if (agencyNumber=="") event.value = "";
else if (agencyNumber=="123") event.value = "Agency A";
else if (agencyNumber=="456") event.value = "Agency B";
else if (agencyNumber=="999") event.value = "Agency C";

 

etc.

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 ,
Aug 06, 2021 Aug 06, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much

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 ,
Aug 26, 2016 Aug 26, 2016

Copy link to clipboard

Copied

I need a variation on this.

In filling out a registration form, sometimes there is one person, sometimes there are 2.  They are entered on separate lines.

acrobat form fields.jpg

Currently I have the form auto-fill the date into both boxes, expecting the form user to delete the unused one.  They never do, and I have to cross it out.  Of course if I take out the second date auto-fill, then they don't enter the date at all and I have to fill it in by hand.  I would like to set it up so if text is entered into the 2nd "Seller's Name" box THEN the current date auto-fills the 2nd date box.  Is this possible?

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 ,
Aug 27, 2016 Aug 27, 2016

Copy link to clipboard

Copied

Yes, that's possible. Use something like this as the custom validation script of the second seller's name field:

if (event.value) this.getField("Date2").value = this.getField("Date1").value;

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 16, 2016 Dec 16, 2016

Copy link to clipboard

Copied

I finally had time to get back to messing with my form.  Your code worked.  Thank you! 

Can you tell me what to add to make sure the date field stays blank if nothing gets entered in the first box?  I noticed if I type in the box, the date fills, but if I remove what I typed, the date box stays populated unless I manually delete it.

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 ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

This code looks like it might work for me but I can't figure out the variables.

I have a field that calculates the responses of other fields, what I want to do is have a text field that will provide specific text based on the calculated field for example

Field 1 is calculated and will score between 8 and 40, I would like to vary the text based on the actual score so <15 "You could do better", between 16 and 32, "that's pretty good" and 33-40 "excellent"

Any help with this would be really 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 ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

As the custom calculation script of Field 2 enter this code:

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

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

else {

    var score = Number(v);

    if (score<15) event.value = "You could do better";

    else if (score>=16 && score<=32) event.value = "That's pretty good";

    else if (score>=33) event.value = "Excellent";

}

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 ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

Thank you so much, that works brilliantly, I would never have got that code without your 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 ,
Jun 14, 2019 Jun 14, 2019

Copy link to clipboard

Copied

Try, I was able to use this code to apply to my issues, but the only thing that comes up is when the score is 1. The script goes on and on

var v = this.getField("ChronologicalAge").valueAsString;

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

else {

var score = Number(v);

  if(score=1) event.value = "Snapshot of 1 month old babies in this area: Babies enjoy looking at faces and will brighten when talked to. They enjoy touch and being held by familiar adults.  Babies recognize their moms by smell, touch, voice and face. They may already start to engage in vocal turn taking.  Babies express feelings by cooing, gurgling and crying. They are learning how to internalize strategies for self-soothing."; else if (score=2) event.value = "Snapshot of 2 month old babies in this area: Babies will now react to caregivers by smiling, vocalizing and moving their arms and legs vigorously with excitement to interact. They enjoy watching faces and are very responsive to facial expressions, movements and tone of voice. Babies enjoy touch and being held by familiar adults. Crying diminishes with eye contact from a caregiver and they maintain eye contact when socializing. Their ability to self soothe is improving. They express feelings by cooing, gurgling and crying.";

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

Copy link to clipboard

Copied

Use:

if (score == 1 ) ...

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

Copy link to clipboard

Copied

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
New Here ,
Aug 04, 2020 Aug 04, 2020

Copy link to clipboard

Copied

Hi 

Thx for all your amazing knowledge @Try67. Your response to above helps in part and I am hoping you can shed some further light on this and how to progress it. 

I have a digial form that has a number of sections completed by various individuals. I am trying to streamline it for staff by having their details autopopulate in the mandatory fields. However a table forms part of this section and not all rows will need to be populated. I want the questions that follow the table to be autopulated with the response in one of two cells reponded to in the table. 

DD80_0-1596599326961.png

 

 

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 20, 2017 Jul 20, 2017

Copy link to clipboard

Copied

So I am hoping to pick your brain and do not know if this calculation will work with my problem.  I have an evaluation rubric where I would like the form to automatically place an "X" in the "Satisfactory_Score" cell If the "TOTAL_pts" cell ranges between 70-89.  How would I do this?  Thank you for any help you can provide me.

adobe pro calculation.JPG

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 20, 2017 Jul 20, 2017

Copy link to clipboard

Copied

Custom calculation script for the Score field:

var v = Number(this.getField("TOTAL_pts").value);

event.value = (v>=70 && v<=89) ? "X" : "";

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 20, 2017 Jul 20, 2017

Copy link to clipboard

Copied

I tried to provide feedback by clicking correct on your reply but could not find the correct link.  Your assistance was awesome, and it worked perfectly.  Thank you very much.

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 21, 2017 Jul 21, 2017

Copy link to clipboard

Copied

Another reply was already marked as correct for this thread, and it can't be done twice, but don't worry about it... And you're welcome!

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 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

Hello,

So I am trying to create a compatibility table in pdf using drop downs. How can you link one drop down to be compatible or link with another drop down box so that it auto-generates the other when you want a name from a drop down list box to match or link to another name in the drop down list from another drop down box? Kinda like I Class A from drop down box list 1 is compatible to Class C in drop down list box 2. Your help is appreciated. 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
New Here ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

I'm trying to populate something based on the value of a previous field. I've been reviewing the previous answers and I can't seem to work out the proper custom calculation script to work.

Field 1 - can be value of A, B or C

Field 2 - value X

Field 3 - value Y

Field 4 - value based on previous fields

What I am trying to get is to populate Field 4 based on the following criteria: If Field 1 is A, then populate value from Field 2. If Field 1 is B or C, then populate value from Field 3.

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 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

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

if (field1=="A") event.value = this.getField("Field 2").value;

else if (field1=="B" || field1=="C") event.value = this.getField("Field 3").value;

else event.value = "";

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