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

Need Script for Dynamic Replication of Fillable PDF Form Fields in Adobe Acrobat Pro

Community Beginner ,
Jan 20, 2024 Jan 20, 2024

Copy link to clipboard

Copied

Hello Adobe Community,
I am currently working on creating a fillable PDF form in Adobe Acrobat DC, and I'm facing a challenge that I believe some scripting expertise could help resolve.

In my form, I have 20 fields named Text1.0 to Text1.9 and Text 2.0 to Text2.9. What I'm looking for is a JavaScript script that, if I enter a value in Text1.3, the script should check Text2.0 to Text2.9 and replicate the value to the first available blank field starting from Text2.0. Similarly, if I enter a value in Text1.7, the script should search for blank fields in Text2.0 to Text2.9 and replicate the value to the next available blank field. And so on.
Screenshot 2024-01-20 161423.png

Any guidance or script snippets that can help achieve this dynamic replication would be highly appreciated. Thank you in advance for your assistance!

TOPICS
Edit and convert PDFs , JavaScript , Modern Acrobat , PDF , PDF forms

Views

248

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 , Jan 20, 2024 Jan 20, 2024

Place this in one field as custom calculation script:

var str = [];
for(var i=0; i<=9; i++) {
var t1 = this.getField("Text1." + i).valueAsString;
if(t1 !== "")
str.push(t1);}

for(var j=0; j<=9; j++) {
var t2 = this.getField("Text2." + j);
if(j<str.length)
t2.value = str[j];
else
t2.value = "";}

Votes

Translate

Translate
Community Expert ,
Jan 20, 2024 Jan 20, 2024

Copy link to clipboard

Copied

Place this (not tested) script in all Text1. fields:

for (var i=0; i < 10; i++) {
	if (this.getField("Text2." +i).value == this.getField("Text2." +i).defaultValue) {
		this.getField("Text2." +i).value = event.value;
		break;
	}	
}

 

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 ,
Jan 21, 2024 Jan 21, 2024

Copy link to clipboard

Copied

It replicates the value, however, when I move downward, it replicates all previously entered values again and again. Thank you btw!

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 21, 2024 Jan 21, 2024

Copy link to clipboard

Copied

I tested my script and it works fine, see attachment.

 

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 ,
Jan 21, 2024 Jan 21, 2024

Copy link to clipboard

Copied

LATEST

Yes, it's working fine. However, @Nesa Nurani's script autodeletes when someone removes a value and auto adjusts the priority when the value is entered above already entered values. Thank you so much 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 ,
Jan 20, 2024 Jan 20, 2024

Copy link to clipboard

Copied

Place this in one field as custom calculation script:

var str = [];
for(var i=0; i<=9; i++) {
var t1 = this.getField("Text1." + i).valueAsString;
if(t1 !== "")
str.push(t1);}

for(var j=0; j<=9; j++) {
var t2 = this.getField("Text2." + j);
if(j<str.length)
t2.value = str[j];
else
t2.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 ,
Jan 21, 2024 Jan 21, 2024

Copy link to clipboard

Copied

Worked like a charm! 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