Answer the question
In order to leave comments, you need to log in
How to render web form component in news.list loop?
Good afternoon, the question is of course idiotic, but still)) this is the conclusion news.list
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>
<div class="box-row" style="overflow: hidden">
<?if($arParams["DISPLAY_TOP_PAGER"]):?>
<?=$arResult["NAV_STRING"]?><br />
<?endif;?>
<? foreach($arResult["ITEMS"] as $arItem):?>
<?
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
?>
<div class="industry-box-prev" id="<?=$this->GetEditAreaId($arItem['ID']);?>">
<?if($arParams["DISPLAY_PICTURE"]!="N" && is_array($arItem["PREVIEW_PICTURE"])):?>
<div style="cursor: pointer" data-toggle="modal" data-target="#modal<?=$arItem["ID"]?>"><img
class="preview_picture"
src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>"
alt="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>"
title="<?=$arItem["PREVIEW_PICTURE"]["TITLE"]?>"
/></div>
<?endif?>
<?if($arParams["DISPLAY_NAME"]!="N" && $arItem["NAME"]):?>
<div style="cursor: pointer" data-toggle="modal" data-target="#modal<?=$arItem["ID"]?>" class="industry-box-prev__title valign-wrapper"> <span><?echo $arItem["NAME"]?></span></div>
<?endif;?>
<!-- <?if($arParams["DISPLAY_PREVIEW_TEXT"]!="N" && $arItem["PREVIEW_TEXT"]):?>
<?echo $arItem["PREVIEW_TEXT"];?>
<?endif;?>-->
<!-- Modal -->
<div class="modal modal-industry fade" id="modal<?=$arItem["ID"]?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<h2><span><?=$arItem["DISPLAY_PROPERTIES"]["TITLES"]["DISPLAY_VALUE"]?> </span>
<div class="close" data-dismiss="modal" aria-hidden="true">
<div class="table-box">
<div class="table-div">
×
</div>
<div class="table-div"><b>Закрыть</b></div>
</div>
</div>
</h2>
<div class="modal-body">
<?if($arParams["DISPLAY_PREVIEW_TEXT"]!="N" && $arItem["PREVIEW_TEXT"]):?>
<?echo $arItem["PREVIEW_TEXT"];?>
<?endif;?>
<div class="box-btn-in text-center"><a style="cursor: pointer" class="btn-in" data-toggle="modal" data-target="#modal-industry-form">
Оставить заявку
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<?endforeach;?>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
<br /><?=$arResult["NAV_STRING"]?>
<?endif;?>
</div>
<div class="box-btn-in text-center"><a style="cursor: pointer" class="btn-in" data-toggle="modal" data-target="#modal-industry-form">
Оставить заявку
</a>
</div>
<?$APPLICATION->IncludeComponent(
"bitrix:form",
"template_form_industry",
array(
"AJAX_MODE" => "Y",
"AJAX_OPTION_ADDITIONAL" => "",
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"CACHE_TIME" => "3600",
"CACHE_TYPE" => "A",
"CHAIN_ITEM_LINK" => "",
"CHAIN_ITEM_TEXT" => "",
"EDIT_ADDITIONAL" => "N",
"EDIT_STATUS" => "N",
"IGNORE_CUSTOM_TEMPLATE" => "N",
"NOT_SHOW_FILTER" => array(
0 => "",
1 => "",
),
"NOT_SHOW_TABLE" => array(
0 => "",
1 => "",
),
"RESULT_ID" => $_REQUEST[RESULT_ID],
"SEF_MODE" => "N",
"SHOW_ADDITIONAL" => "N",
"SHOW_ANSWER_VALUE" => "N",
"SHOW_EDIT_PAGE" => "N",
"SHOW_LIST_PAGE" => "N",
"SHOW_STATUS" => "N",
"SHOW_VIEW_PAGE" => "N",
"START_PAGE" => "new",
"SUCCESS_URL" => "",
"USE_EXTENDED_ERRORS" => "Y",
"WEB_FORM_ID" => "1",
"COMPONENT_TEMPLATE" => "template_form_industry",
"VARIABLE_ALIASES" => array(
"action" => "action",
)
),
false
);?>
Answer the question
In order to leave comments, you need to log in
You are trying to display a bitrix:form complex component inside news.list . You shouldn't do that. I understand that you need to display some text in one of the form fields, depending on the $arItem element in news.list. For example, the name of a product.
I would solve this problem like this:
1) create the /ajax/form.php file - place the bitrix:form.new component in it (set the ajax mode in its parameters - AJAX_MODE => Y, etc.)
2) Write the js script which will display this form in a modal. You can use fancybox or the standard bx library. (BX.PopupWindowManager). After the output of the modal, we substitute the name of the product we need into the form.
3) In the news.list template, we create a button on which we hang our js script.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question