Answer the question
In order to leave comments, you need to log in
Why is the onAfterResultAdd event handler not working?
1C-Bitrix: Site Management 20.0.950
Forms were already in the solution from Aspro.
When submitting form ID 15, I try to change the UF_CLIENT user field, but it doesn't work.
I'm trying to just send myself a message when submitting the form, but nothing comes up.
The message itself comes from the form, but the onAfterResultAdd event doesn't fire.
Tell me what I'm doing wrong?
In init.php added:
<?
AddEventHandler("form", "onAfterResultAdd", "wsAfterForm");
function wsAfterForm($WEB_FORM_ID, $RESULT_ID) {
if ($WEB_FORM_ID == 15) {
mail("моя_почта", "Тест формы", "Тест формы");
// global $USER;
// $USER_ID = $USER->GetID();
// $user = new CUser;
// $fields = Array(
// "UF_CLIENT" => "1",
// );
// $user -> Update($USER_ID, $fields);
}
}
?>
Answer the question
In order to leave comments, you need to log in
User PetrPo in the comments helped to sort out the problem.
It was necessary to track the infoblock instead of the form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question