Autopopulate form fields

New Here ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Hi,

 

I have two unique form fields.

I am attaching a screen shot of the form fields.

The first form field is called #1.

The second form field is called #2.

The third form field is called #3.

 

When someone enters an answer into EITHER #1 OR #2, i want that answer to be pre-populated to #3. If #1 is blank, but #2 has a response, then that response goes into #3.

 

Same is true if #2 is left but #1 has a response, then that response should go to #3.

 

How can i accomplish this? I am using Adobe Acrobat Pro DC. If there is coding i need to put, where and how do i do this?

 

 

edoble2_0-1654734715165.png

 

TOPICS
PDF forms

Views

33

Likes

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
Adobe Community Professional ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

What happen if both fields are filled?

You can use this as custom calculation of "#3" field:

var a = this.getField("#1").value;
var b = this.getField("#2").value;
if(a &&!b)
event.value = a;
else if(!a && b)
event.value = b;
else
event.value = "";

Likes

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 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

where do i enter this code? can you provide screen shots?

 

both fields will not be filled in, either one of the fields will be filled in, that's how the questions is designed, the user should not be answering both questions.

Likes

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
Adobe Community Professional ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

LATEST

Select 'Prepare form' tool -> right click "#3" field and select properties, click on 'Calculate' tab -> select 'Custom calculation script' -> click on 'Edit' -> paste script in the Javascript editor and click 'Ok'.

Likes

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