onBeforeResultUpdate
Description and parameters
handler function( int WEB_FORM_ID, int RESULT_ID, array &arFields, array &arrVALUES, string(1) CHECK_RIGHTS );Event handlers are called before saving updates in existing webform result. This can be used for any additional checks or updates for webform result fields. Handler is not designed to return any values. Errors can be returned via $APPLICATION->ThrowException().
Parameters
Parameter | Description |
---|---|
WEB_FORM_ID | Webform ID. |
RESULT_ID | Result ID. |
arFields | Array with result fields to be written in the database. |
arrVALUES | Array with webform result response values. |
CHECK_RIGHTS | Flag "Check access permissions" (Y|N). |
See Also
Example of handler function
public static function my_onBeforeResultUpdate($WEB_FORM_ID, $RESULT_ID, $arFields, $arrVALUES) { global $APPLICATION; // handler action applies only to the webform with ID=6 if ($WEB_FORM_ID == 6) { // text query with ID=135 must contain an integer, more than 5. $arrVALUES['form_text_135'] = intval($arrVALUES['form_text_135']); if ($arrVALUES['form_text_135'] < 5) { // when value doesn't match - sends error. $APPLICATION->ThrowException('Value must be more or equal to 5!'); } } } AddEventHandler('form', 'onBeforeResultUpdate', 'my_onBeforeResultUpdate');
© «Bitrix24», 2001-2024