V
V
Vladimir2017-04-29 11:12:27
PHP
Vladimir, 2017-04-29 11:12:27

How to write your function in a component call?

Tell me how to call your function in the Bitrix component.
"EMAIL_CHECK_FUNCTION" => "",
I want to check email
Here is the component

<?$APPLICATION->IncludeComponent(
  "Form", 
  "test", 
  array(
    "COMPONENT_TEMPLATE" => "form",
    "IBLOCK_ID" => "",
    "PUT_ACTIVE" => "N",
    "FIELDNAMES" => array(
      0 => "NAME",
      1 => "EMAIL",
    ),
    "NAME_REQUIRED" => "Y",
    "AUTHOR_IBLOCK_FIELD" => "NAME",
    "EMAIL_REQUIRED" => "Y",
    "EMAIL_IBLOCK_FIELD" => "NAME",
    "EMAIL_CHECK_FUNCTION" => "",
  ),
  false
);?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2017-05-01
Portev @Vladimir Portev

If you do not take into account that the somewhat strange name of the component (without vendor), and ignorance of the internals of the component, then there are several tips
: be responsible for validation, initialization, etc.)
2. Pass callback to parameters (array, string, object - this option is better), and actually call the function inside the component.
3. Implement the check inside the component (but then you won't be able to change the check conditions dynamically)
The options are sorted by degree of adequacy in descending order, and by degree of simplicity in descending order. In short:
1 - the most correct, the most difficult;
3 - the easiest, the most redneck.

N
no_one_safe, 2017-04-30
@no_one_safe

Read the course about components https://dev.1c-bitrix.ru/learning/course/?COURSE_I...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question