• 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
Community Expert ,
Aug 05, 2016 Aug 05, 2016

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

Thank you -- this is exactly what I needed

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

Copy link to clipboard

Copied

Can you do the same for a text field?  I have a 5 page pdf.  I fill out the information on page 1, I want certain information from Page 1 to be autofilled to other pages in the pdf.  What would be the syntax?

Thank you for 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
Community Expert ,
Aug 22, 2016 Aug 22, 2016

Copy link to clipboard

Copied

You don't need any script. Just copy and paste the fields and they'll have the same value automatically.

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

Copy link to clipboard

Copied

Thank you and verified. Too easy.

John Storms

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

Copy link to clipboard

Copied

Good morning,

i am attempting to auto fill text text based on the response from a radial selection answer. How would I go about that?

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

Copy link to clipboard

Copied

Can you elaborate a bit?

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

Copy link to clipboard

Copied

I have four radial selections. You can select one of four options. Based on those selections I want an auto fill of a section after it.

for example selection 1 would auto fill a specific set of criteria, section 2 would auto fill a specific set of criteria, and so forth.

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

Copy link to clipboard

Copied

Your description is still very vague... Basically you can use a custom calculation script for the text fields or a custom mouse-up script for the radio-buttons.
The former would be something like this:

if (this.getField("Radio1").valueAsString=="1") event.value = "Some text";

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
New Here ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

I do not know how else to explain it. I will try your script. But I will also try to explain it better just in case.

I have a form where I have the option of selecting ONE of four selections as the answer to a question.

for example

residents end goal is FFA/Downgrade of care/Reunification/Age out.

based on the selection of ONE of those options, I want text to auto fill into a text box below it For that specific selection. Is that possible? And is that the correct script?

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

Copy link to clipboard

Copied

Yes, in that case you can use the script I provided, with minor adjustments to accomodate for the correct field name and values.

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

Copy link to clipboard

Copied

It does not seem to be working. I might be inserting the wrong information? Do I put the script under the radial settings or the text box i want filled settings?

And what information do I plug into the script?

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

Copy link to clipboard

Copied

So The radial group is categorized as Group 28 at the first option titled FFA .I want for when it is selected to auto fill text into the text box labeled "Mandatory end goals"

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

Copy link to clipboard

Copied

Use this code as the custom calculation script of the text field:

var v = this.getField("Group 28").valueAsString;

if (v=="FFA") event.value = "Mandatory end goals";

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
New Here ,
Feb 13, 2017 Feb 13, 2017

Copy link to clipboard

Copied

i am hoping to complete this form soon in order to launch its use.

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

Copy link to clipboard

Copied

Hi Try67,

I've tried this script a few times and I think it's just my lack of knowledge.

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

I want to enter a height in my box named Height and it autopopulate a max weight in the box labeled Max Weight.

I'm just not sure where to fill in the proper terminology. For example 72 should populate 209.

If you have a moment would you be so kind to assist? I would be grateful.

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

Copy link to clipboard

Copied

Is there a formula behind it, or just an arbitrary weight value for each height 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 01, 2018 Dec 01, 2018

Copy link to clipboard

Copied

Well the weight is different for a male to a female,

I have a drop down box to choose male or female.

If a male is chosen I need to enter multiple heights and max weights for different age groups.

For example a male between the ages of 17-20 at 72 inches height is a max weight is 200

A female 17-20 at 72 inches height is 189 pd.

I just realized this became more complicated then I thought based off those different age group variables.

Is this even 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 ,
Dec 01, 2018 Dec 01, 2018

Copy link to clipboard

Copied

Yes, but as you've mentioned there are multiple parameters here: Age, Gender, Height. So that means you will need quite a complex code to account for all possible combinations. I will give you the most basic code to achieve it and you can expand it from there:

var gender = this.getField("Gender").valueAsString;

var age = Number(this.getField("Age").valueAsString);

var height = Number(this.getField("Height").valueAsString);

event.value = "";

if (gender=="Male" && age>=17 && age<=20 && height==72) event.value = 200;

if (gender=="Female" && age>=17 && age<=20 && height==72) event.value = 189;  // etc.

This code should be placed as the custom calculation script of the Max Weight field.

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

Copy link to clipboard

Copied

Gosh ur amazing, I will try this and let you know, do you have a recommendation for learning this such as a specific course, or learning material?

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

Copy link to clipboard

Copied

General JS tutorial (note that only the core syntax applies to Acrobat): JavaScript Tutorial

Homepage for Acrobat JavaScript development, including a link to the full API: Adobe - Acrobat Developer Center | Adobe Developer Connection

Free tutorials about Acrobat in general, including many JS related ones: https://acrobatusers.com/tutorials/

A paid-for website with tutorials about Acrobat JavaScript (not related to me): pdfscripting.com

My humble web-site with many tools for Acrobat (mostly paid-for, some free): Custom-made Adobe Scripts

Good luck!

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

Copy link to clipboard

Copied

I am getting a syntax error before statement, any thoughts?  v.r.

syntexerror.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 ,
Dec 01, 2018 Dec 01, 2018

Copy link to clipboard

Copied

Remove the line numbers. They are not a part of the code, just for reference. And they shouldn't have come through if you copied the code the site, anyway...

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 ,
Feb 26, 2020 Feb 26, 2020

Copy link to clipboard

Copied

Hi Try67, 

Can you help me figure out the correct code to do this? 

I currently have a dropdown field with 270, 570, 770.

If 270 is selected, the value (5995) will populate in the "Unit Price" form field.

If 570 is selected, the value (6995) will populate in the "Unit Price" form field.

If 770 is selected, the value (7995) will populate in the "Unit Price" form field.

 

If 270/570/770 is selected, can it trigger the other dropdown fields to that value? 

If 270 is selected, "270 sheets" will populate into the dropdown field below. 

If 570 is selected, "570 sheets" will populate into the dropdown field below. 

If 770 is selected, "770 sheets" will populate into the dropdown field below. 

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