Answer the question
In order to leave comments, you need to log in
How to display the default value of a property?
A component with a feedback form has been developed (receives the data left by the user in the inputs and enters them into the info block). I display on the page through bitrix:news.list
. You need to add a new property with a binding to the user. In this case, if VALUE
the property is empty, you need to display "Application is open". However, the logic of the component is such that if VALUE
the property is empty, then DISPLAY_PROPERTIES
it does not fall into it. I think the most correct approach is:
<input type="hidden">
from name
this property and value="Заявка открыта"
, and thus add an element to DISPLAY_PROPERTIES
;CIBlockElement::Update
the user ID;Answer the question
In order to leave comments, you need to log in
I borrowed this approach from the component controller. In case the DEFAULT_VALUE property is filled, it also contributes to DISPLAY_PROPERTIES.
foreach($arResult["ITEMS"] as &$arItem)
{
foreach($arParams["PROPERTY_CODE"] as &$pid)
{
$prop = $arItem["PROPERTIES"][$pid];
if(
(is_array($prop["DEFAULT_VALUE"]) && count($prop["DEFAULT_VALUE"])>0)
|| (!is_array($prop["DEFAULT_VALUE"]) && strlen($prop["DEFAULT_VALUE"])>0)
)
{
$arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $prop, "news_out");
}
}
}
unset($arItem, $pid);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question