onBeforeResultAdd
Description and parameters
handler function( int WEB_FORM_ID, array &arFields, array &arrVALUES );Event handlers are called before adding new 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. |
arFields | Array with result fields to be written in the database. |
arrVALUES | Array with webform result response values. |
See Also
Handler function result
public static function my_onBeforeResultAdd($WEB_FORM_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', 'onBeforeResultAdd', 'my_onBeforeResultAdd');
© «Bitrix24», 2001-2024