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

How to create a checkbox that will replicate several empty text fields when checked

New Here ,
May 29, 2024 May 29, 2024

Complete novice here.

 

I'm creating a form to get names, addresses, and other data on individuals.  Preferrably, I would like for several empty text fields to replicate if a checkbox is checked.  Basically, if there is more than one person involved they can check the box and all the text fields used for the initial person are replicated together and cleared out so that the next person's information can be input.

 

Is that possible in Acrobat?  If so, how?

 

Thanks for any assistance!

TOPICS
How to , JavaScript , PDF forms
354
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 ,
May 29, 2024 May 29, 2024

I would use a button for this, not a check-box, as that can be confusing.

The basic code will be something like this:

 

this.getField("Name2").value = this.getField("Name1").value;
this.getField("Address2").value = this.getField("Address1").value;
this.getField("Zipcode2").value = this.getField("Zipcode1").value;
this.resetForm(["Name1", "Address1", "Zipcode1"]);
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 ,
May 29, 2024 May 29, 2024

Thanks!  Can you please explain if I add this to the properties of the button or elsewhere?  I'm truly a novice.

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 ,
May 29, 2024 May 29, 2024
LATEST

Put it under the Mouse Up event of a button field.

However, keep in mind this code will always copy the values to the next set of fields after the first one, overwriting any existing values they have. If you have multiple such sets you would need to use a more advanced code to identify the first empty set (if any), and then copy the values to it.

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