Documentation

onAfterResultUpdate

Description and parameters

handler function(
 int WEB_FORM_ID,
 int RESULT_ID,
 string(1) CHECK_RIGHTS
);
Event handlers are called after saving updates in existing webform result. This can be used for executing any additional operations with webform result; for example, for sending extra notifications using email. Handler is not designed to return any values. You can update webform result fields using CFormResult::SetField().

Parameters

ParameterDescription
WEB_FORM_ID Webform ID.
RESULT_ID Result ID.
CHECK_RIGHTS Flag "Check permissions" (Y|N).

See Also

Handler function example

public static function my_onAfterResultAddUpdate($WEB_FORM_ID, $RESULT_ID)
{
  // handler action applies only to the webform with ID=6
  if ($WEB_FORM_ID == 6) 
  {
    // write user IP address to the additional field 'user_ip'
    CFormResult::SetField($RESULT_ID, 'user_ip', $_SERVER["REMOTE_ADDR"]);
  }
}

// register function as handler for two events
AddEventHandler('form', 'onAfterResultAdd', 'my_onAfterResultAddUpdate');
AddEventHandler('form', 'onAfterResultUpdate', 'my_onAfterResultAddUpdate');

© «Bitrix24», 2001-2024