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

Setting a form field to auto fill based on another field

New Here ,
Aug 05, 2016 Aug 05, 2016

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
145.2K
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
1 ACCEPTED SOLUTION
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;

View solution in original post

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
replies 102 Replies 102
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;

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

Thank you -- this is exactly what I needed

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

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.

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

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

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

Thank you and verified. Too easy.

John Storms

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

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

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

Can you elaborate a bit?

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

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.

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

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 = "";

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

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?

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

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

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

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

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

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"

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

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 = "";

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

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

thank you

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

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.

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

Is there a formula behind it, or just an arbitrary weight value for each height value?

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

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?

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

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.

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

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?

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

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!

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

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

syntexerror.PNG

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

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...

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

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. 

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