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

Copying controls with properties using Java script

Explorer ,
Nov 07, 2022 Nov 07, 2022

Is there any easy way to use a script to duplicate a field (text, combo, list, checkbox, radio ...) with properties? So I have a field and I want to make an exact copy of it (frames, colors, fonts, formats, etc.) elsewhere in the form, of course under a different name. I want to avoid tediously rewriting all properties one by one (as I do so far).

TOPICS
How to , JavaScript , PDF forms
1.0K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Nov 08, 2022 Nov 08, 2022

To answer your question: No, not easily. You have to create the field from scratch, and then copy each individual property from the source field to the target one. Some things can't be copied, though. Basically anything that's an action (like Format, Calculate, Validate, Mouse Up, Mouse Enter, etc.), as well as some special properties, such as Direction "Right to Left/Left to Right".

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
Community Expert ,
Nov 08, 2022 Nov 08, 2022

If you know what script you want to use you can apply it, of course, but you can't actually copy it from one field to another (because you can't read the script applied to any event, unfortunately).

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
Community Expert ,
Nov 08, 2022 Nov 08, 2022

Right-click on the field : Create Multiple Copies.

 

Capture_2211080907.pngexpand image


Acrobate du PDF, InDesigner et Photoshoptographe
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
Explorer ,
Nov 08, 2022 Nov 08, 2022

Please read the post carefully .... the question is how to do it using a java script, e.g. after pressing a key.

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 ,
Nov 08, 2022 Nov 08, 2022

It is not possible to copy all properties from one field to another with JavaScript.

You should use CTRL-C and CTRL-V (copy-paste).


Acrobate du PDF, InDesigner et Photoshoptographe
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
Explorer ,
Nov 08, 2022 Nov 08, 2022

I'm sorry but you don't understand my need. How do I apply Ctrl + C and Ctrl + V in a Java script for a control?

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 ,
Nov 08, 2022 Nov 08, 2022
LATEST

I understood and I wrote "not possible…with JavaScript". (See try67 explainations)

I meant that using the keys CTRL-C & CTRL-V you can copy-paste a field with all its properties, without the need of a script.


Acrobate du PDF, InDesigner et Photoshoptographe
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 ,
Nov 08, 2022 Nov 08, 2022

Why want you a script for this?

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
Explorer ,
Nov 08, 2022 Nov 08, 2022

I want to dynamically create tables and add or delete rows. There is no table control in Adobe DC so you have to deal with it somehow. In fact, I already have such a procedure, but I wanted to simplify it and reduce its volume.

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 ,
Nov 08, 2022 Nov 08, 2022

To answer your question: No, not easily. You have to create the field from scratch, and then copy each individual property from the source field to the target one. Some things can't be copied, though. Basically anything that's an action (like Format, Calculate, Validate, Mouse Up, Mouse Enter, etc.), as well as some special properties, such as Direction "Right to Left/Left to Right".

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
Explorer ,
Nov 08, 2022 Nov 08, 2022

OK, that's what I was afraid of, although I put simple formatting scripts with code .....

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 ,
Nov 08, 2022 Nov 08, 2022

If you know what script you want to use you can apply it, of course, but you can't actually copy it from one field to another (because you can't read the script applied to any event, unfortunately).

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
Explorer ,
Nov 08, 2022 Nov 08, 2022

This explains the issue, because my memory has already given me examples where I have seen the insertion of large parts of the script, in addition, it seems to be formatted in RTF.

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 ,
Nov 08, 2022 Nov 08, 2022

No, a script is always plain-text only.

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