S
S
Sp1keazyYT2019-04-18 20:35:20
JavaScript
Sp1keazyYT, 2019-04-18 20:35:20

Why does ReCaptcha disappear on an ajax request in a Bitrix form?

Good evening. I have a form component. I call like this:

<?$APPLICATION->IncludeComponent(
  "vilka:feedback", 
  "style2", 
  array(
    "USE_CAPTCHA" => "Y",
    "OK_TEXT" => GetMessage("OK_TEXT"),
    "EMAIL_TO" => $defEmail,
    "SHOW_FIELDS" => array(
      0 => "NAME",
      1 => "PHONE",
    ),
    "REQUIRED_FIELDS" => array(
      0 => "NAME",
      1 => "PHONE",
    ),
    "AJAX_MODE" => "Y",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_ADDITIONAL" => "",
    "FORM_ID" => "548f0a3cd5265",
    "MAIL_TITLE" => GetMessage("MAIL_TITLE"),
    "COMPONENT_TEMPLATE" => "style2"
  ),
  false
);?>


On the site saratovutil64.ru you can see the recaptcha in the form "LEAVE YOUR REQUEST". Calling the captcha with the following code:
<div class="g-recaptcha" data-sitekey="<?=RE_SITE_KEY?>"></div>

where RE_SITE_KEY is the site key.
The Google script is included in the header of the site.
Help me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
imdeveloper, 2019-04-19
@link_web

well, you can see that the controller returns html in the response, which does not contain a captcha:
Accordingly, look for this template that arrives in the response and insert the captcha there

D
denador, 2020-05-16
@denador

Just add api.js connection not in header.php. And right in the component template above the block

<div class="g-recaptcha" data-sitekey="<?=RE_SITE_KEY?>"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question