Update
bool CFormResult::Update( int result_id, array values = false, string update_fields = "N", string check_rights = "Y" )
Updates all values of answers and fields for the result of web form. Returns true on success, false otherwise. Non-static method.
Method parameters
Parameter | Description |
---|---|
result_id | Result ID. |
values | Array with values of answers and fields of web form. Array has the following structure:
array( "HTML name of field 1" => "value 1", "HTML name of field 2" => "value 2", ... "HTML name of field N" => "value N" )Rules for generating "HTML field names" and "values" can be viewed here. Example:Array ( [form_text_586] => John Smith [form_date_587] => 10.03.1984 [form_textarea_588] => New York [form_radio_VS_MARRIED] => 589 [form_checkbox_VS_INTEREST] => Array ( [0] => 592 [1] => 593 [2] => 594 ) [form_dropdown_VS_AGE] => 597 [form_multiselect_VS_EDUCATION] => Array ( [0] => 603 [1] => 604 ) [form_text_606] => 2345 [form_image_607] => 1045 [form_textarea_ADDITIONAL_149] => 155 )Optional parameter. False by default (standard array $_REQUEST will be taken). |
update_fiels | Flag that defines the requirement to update fields of the web form.
Possible values:
|
check_rights | Flag that defines the requirement to check current user access permissions. The following values are required:
|
See Also
Examples of use
<? // Result ID $RESULT_ID = 186; // array describing the photo, uploaded onto the server $arImage = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"]."/images/photo.gif"); // array of answer and field values for the web form $arValues = array ( "form_text_586" => "John Smith", // "Full name" "form_date_587" => "01.06.1984", // "Date of birth" "form_textarea_588" => "New York", // "Address" "form_radio_VS_MARRIED" => 590, // "Marital status?" "form_checkbox_VS_INTEREST" => array(612, 613), // "Hobbies" "form_dropdown_VS_AGE" => 601, // "Age" "form_multiselect_VS_EDUCATION" => array(602, 603), // "Education" "form_text_606" => 300, // "Income" "form_image_607" => $arImage, // "Photo" "form_textarea_ADDITIONAL_149" => "155 USD" // "Estimated sum" ) //update the result if (CFormResult::Update($RESULT_ID, $arValues, "Y")) { echo "The #".$RESULT_ID." updated successfully."; } else { global $strError; echo $strError; } ?>
© «Bitrix24», 2001-2024