Answer the question
In order to leave comments, you need to log in
Why is the site body displayed instead of the form result?
Added processing to init.php
AddEventHandler("iblock", "OnAfterIBlockElementAdd", Array("wsAfterForm", "wsOnAfterResultAdd"));
class wsAfterForm {
function wsOnAfterResultAdd(&$arFields) {
if ($arFields["IBLOCK_ID"] == 15) {
global $USER;
$USER_ID = $USER->GetID();
$user = new CUser;
$fields = Array(
"UF_CLIENT" => "1",
);
$user -> Update($USER_ID, $fields);
return false; // Пробовал убирать или добавлять, не помогает
}
}
}
Answer the question
In order to leave comments, you need to log in
User PetrPo in the comments helped to sort out the problem.
The form on the infoblock with AJAX, turned off AJAX and began to work as it should.
return false
extra construction, because nothing is canceled in the after event .
The output of the message "You have sent your request" is definitely not done in this piece of code.
The body of the site is most likely displayed along with an error, see the code that is given, and check the log.
And for good, it would be nice to add a check, but is the user authorized?
Add modifiers to the method public static function
to uniquely identify it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question