Bitrix Site Manager

CForm::GetClosedFields

text
CForm::GetClosedFields(
 int FORM_ID,
 array arFields
);

The method returns the HTML code consisting of the fields with ID's equal to ID's of questions and fields passed as the second parameter. The fields have the hidden attribute set.

The method is used in result editing templates to limit the set of questions and fields to those passed to this method. If a result editing template provides only a subset of all form fields, values of the absent fields will be deleted from the database upon save. This method allow to prevent this side-effect.

Parameters

ParameterDescription
FORM_ID Form ID.
arFields Array of the symbolic ID's of the emitted fields.

Example

The following code is used in the real result editing template.


<form name="<?=$arForm["VARNAME"]?>" 
      action="<?=$APPLICATION->GetCurPage()?>?
              lang=<?=LANG?>&WEB_FORM_ID=<?echo $WEB_FORM_ID?>&
              RESULT_ID=<?echo $RESULT_ID?>" 
      method="POST" enctype="multipart/form-data">
<input type="hidden" name="WEB_FORM_ID" value="<?=intval($WEB_FORM_ID)?>">
<input type="hidden" name="lang" value="<?=LANG?>">
<input type="hidden" name="VIEW_TEMPLATE" value="<?=htmlspecialchars($VIEW_TEMPLATE)?>">
<?
// emit the hidden fields of questions which are not to be edited
echo CForm::GetClosedFields($WEB_FORM_ID, 
	array(
		"CL_POLICY_SERIES", 
		"CL_POLICY_NUMBER", 
		"CL_SYMBOL_SERIES", 
		"CL_SYMBOL_NUMBER", 
		"CL_TICKET_SERIES", 
		"CL_TICKET_NUMBER", 
		"CL_AGENT_TECH", 
		"CL_AGENT_GENERAL", 
		"CL_CENTER", 
		"CL_COMMENTS"));
?>