D
D
Dmitry Klimantovich2021-03-05 16:16:53
1C-Bitrix
Dmitry Klimantovich, 2021-03-05 16:16:53

How to pass a checked Checkbox when creating an infoblock element from the frontend side?

Good afternoon.

There is a form with a checkbox input, which, when submitted, creates an element in the infoblock.
Parameters are passed

$arFields = array(
 "PROPERTY_VALUES" 	=> array (
      "FORM_REQUEST"     => $_POST['FORM_REQUEST'] !== false ? "Y" : ""
  )
);
$oElement = new CIBlockElement();
$idElement = $oElement->Add($arFields, false, false, true);

The element is created, but the checkbox in the FORM_REQUEST property of the element is not checked,
what's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Klimantovich, 2021-03-05
@dikey58

It turns out that you need to pass the value ID, like this:

"FORM_REQUEST"		=> isset($_POST['FORM_REQUEST']) ? array(4) : ''
3
604236802dc0a410718194.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question