Вызов компонента:
<?$APPLICATION->IncludeComponent(
"bitrix:form.result.new",
"popup",
array(
"COMPONENT_TEMPLATE" => "popup",
"WEB_FORM_ID" => "1",
"IGNORE_CUSTOM_TEMPLATE" => "N",
"USE_EXTENDED_ERRORS" => "Y",
"SEF_MODE" => "N",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "3600",
"LIST_URL" => "",
"EDIT_URL" => "",
"SUCCESS_URL" => "",
"CHAIN_ITEM_TEXT" => "",
"CHAIN_ITEM_LINK" => "",
"VARIABLE_ALIASES" => array(
"WEB_FORM_ID" => "WEB_FORM_ID",
"RESULT_ID" => "RESULT_ID",
),
"AJAX_MODE" => "Y",
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_SHADOW" => "N",
"AJAX_OPTION_STYLE" => "N",
"AJAX_OPTION_ADDITIONAL" => "",
),
false
);?>
Шаблон:
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
?>
<? /* if ($arResult["isFormErrors"] == "Y") { ?>
<?=$arResult["FORM_ERRORS_TEXT"];?>
<? } */?>
<? if ($arResult["isFormNote"] != "Y") { ?>
<div class="form-popup-title"><?=$arResult["FORM_TITLE"]?></div>
<?=$arResult["FORM_HEADER"]?>
<? foreach ($arResult["QUESTIONS"] as $FIELD_SID => $arQuestion) { ?>
<?
$fieldError = '';
if ($arQuestion['STRUCTURE'][0]['FIELD_TYPE'] == 'hidden') {
$fieldHidden = str_replace('name=', 'class="field-'.ToLower($FIELD_SID).'" name=', $arQuestion["HTML_CODE"]);
echo $fieldHidden;
} else {
$fieldClass = "form-field-input field-".ToLower($FIELD_SID);
if (is_array($arResult["FORM_ERRORS"]) && array_key_exists($FIELD_SID, $arResult['FORM_ERRORS'])) {
$fieldClass.= ' field-error ';
$fieldError = '<div class="form-field-error">Поле обязательно для заполнения</div>';
}
if ($arQuestion["REQUIRED"] == "Y") {
$arQuestion["CAPTION"] = $arQuestion["CAPTION"].' *';
}
$field = str_replace('type=', 'placeholder="'.$arQuestion["CAPTION"].'" class="'.$fieldClass.'" type=', $arQuestion["HTML_CODE"]);
echo '<div class="form-field">'.$field.$fieldError.'</div>';
}
?>
<? } ?>
<?if($arResult["isUseCaptcha"] == "Y"){?>
<input type="hidden" name="captcha_sid" value="<?=htmlspecialcharsbx($arResult["CAPTCHACode"]);?>" />
<?=GetMessage("FORM_CAPTCHA_FIELD_TITLE")?><?=$arResult["REQUIRED_SIGN"];?>
<img src="/bitrix/tools/captcha.php?captcha_sid=<?=htmlspecialcharsbx($arResult["CAPTCHACode"]);?>" width="180" height="40" />
<input type="text" name="captcha_word" size="30" maxlength="50" value="" class="form-field-input" />
<?}?>
<input class="btn" type="submit" value="<?=$arResult["arForm"]["BUTTON"]?>" name="web_form_submit">
<?=$arResult["FORM_FOOTER"]?>
<? } else {?>
<div class="form-popup-success">Ваша заявка успешно отправлена.<br> Скоро мы Вам перезвоним!</div>
<? } ?>
<script>
$('.field-phone').mask('+7 (999) 999-99-99');
</script>
Комментарии ()