Bitrix Site Manager

CFormField::Copy

mixed
CFormField::Copy(
 int field_id,
 string check_rights = "Y",
 mixed form_id = false
)

The method Copy copies a question or a field of a web form. Returns the ID the new question or field on success, or false otherwise.

Parameters

Parameter Description
field_id The ID of the question or the field which is to be copied.
check_rights Flag specifying the current user permissions should be checked. One of the following values is possible:
  • Y - permissions should be checked;
  • N - no checks need to be performed.
A user must have the following permissions to copy a question or a field:
  1. [25] view web form parameters for the source web form;
  2. [30] full access for the destination web form.
Optional. "Y" by default which means the permissions should be checked.
form_id The ID of the destination web form to which a question or a field should be copied.
Optional. False by default which means that the current web form is used.

See Also

Example



<?
$FIELD_ID = 140; // The question ID
// copy the question
if ($NEW_FIELD_ID=CFormField::Copy($FIELD_ID))
{
    echo "The question #140 has been successfully copied to the new question #".$NEW_FIELD_ID; 
}
else
{
    // display the error description 
    global $strError;
    echo $strError;
}
?>