Skip to main content

Copy

Copies the current form (copies with the shape if it exists).

Inherited from ApiFormBase.Copy.

Syntax​

expression.Copy();

expression - A variable that represents an ApiCheckBoxForm class.

Parameters​

This method doesn't have any parameters.

Returns​

ApiForm

Example​

Duplicate an existing checkbox form field and insert the copy into a document.

// How do I reuse a checkbox form by making an identical copy of it in a document?

// Add a second radio button with the same settings as the first without recreating it from scratch in a document.

let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true});
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Married");
let copyCheckBoxForm = checkBoxForm.Copy();
paragraph.AddLineBreak();
paragraph.AddElement(copyCheckBoxForm);
paragraph.AddText(" Single");