Skip to main content
Piotr Smolen
Inspiring
November 8, 2022
Answered

Copying controls with properties using Java script

  • November 8, 2022
  • 3 replies
  • 1399 views

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

This topic has been closed for replies.
Correct answer try67

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

3 replies

try67
Community Expert
Community Expert
November 8, 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".

Piotr Smolen
Inspiring
November 8, 2022

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

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 8, 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).

Bernd Alheit
Community Expert
Community Expert
November 8, 2022

Why want you a script for this?

Piotr Smolen
Inspiring
November 8, 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.

JR Boulay
Community Expert
Community Expert
November 8, 2022

Right-click on the field : Create Multiple Copies.

 

Acrobate du PDF, InDesigner et Photoshopographe
Piotr Smolen
Inspiring
November 8, 2022

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

JR Boulay
Community Expert
Community Expert
November 8, 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 Photoshopographe