Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #form.result.new/template.php
- <?
- if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
- ?>
- <span id="getcard" class="white-popup mfp-hide">
- <div id="msg">
- <?if ($arResult["isFormErrors"] == "Y"):?>
- <div id="fail"><?=$arResult["FORM_ERRORS_TEXT"];?></div>
- <?endif;?>
- <?if($arResult["FORM_NOTE"]):?>
- <div id="success"><?=$arResult["FORM_NOTE"];?></div>
- <?endif;?>
- </div>
- <?if ($arResult["isFormNote"] != "Y" || $arResult["isFormNote"] != "N")
- {
- ?>
- <? if ($_REQUEST['AJAX_REQUEST'] !== 'Y') {?>
- <form id="card-form" class="card-form" method="POST" action="<?=POST_FORM_ACTION_URI?>" enctype="multipart/form-data" name="<?=$arResult["WEB_FORM_NAME"]?>">
- <? } ?>
- <input type="hidden" name="WEB_FORM_ID" value="<?= $arParams["WEB_FORM_ID"] ?>">
- <?= bitrix_sessid_post() ?>
- <? foreach ($arResult["QUESTIONS"] as $FIELD_SID => $arQuestion) {?>
- <div>
- <? if (is_array($arResult["FORM_ERRORS"]) && array_key_exists($FIELD_SID, $arResult['FORM_ERRORS'])):?>
- <span class="error-fld" title="<?= $arResult["FORM_ERRORS"][$FIELD_SID] ?>"></span>
- <? endif; ?>
- <div id="form-fio">
- <? if ($arQuestion["CAPTION"] == "Имя"):?>
- <!--<label><?/*= $arQuestion["CAPTION"] */?>: <?/* if ($arQuestion["REQUIRED"] == "Y"):*/?><span style="color: red;">*</span><?/* endif; */?></label>-->
- <input type="<?= $arQuestion["STRUCTURE"]["0"]["FIELD_TYPE"] ?>" name="form_text_<?= $arQuestion["STRUCTURE"]["0"]["ID"] ?>" id="name" placeholder="Ваше имя*"/>
- <? endif ?>
- </div>
- <div id="form-contact">
- <? if ($arQuestion["CAPTION"] == "E-mail"):?>
- <!--<label><?/*= $arQuestion["CAPTION"] */?>: <?/* if ($arQuestion["REQUIRED"] == "Y"):*/?><span style="color: red;">*</span><?/* endif; */?></label>-->
- <input type="<?= $arQuestion["STRUCTURE"]["0"]["FIELD_TYPE"] ?>" name="form_email_<?= $arQuestion["STRUCTURE"]["0"]["ID"] ?>" id="email" placeholder="Ваш E-mail*"/>
- <? endif ?>
- <? if ($arQuestion["CAPTION"] == "Номер телефона"):?>
- <!--<label><?/*= $arQuestion["CAPTION"] */?>: <?/* if ($arQuestion["REQUIRED"] == "Y"):*/?><span style="color: red;">*</span><?/* endif; */?></label>-->
- <input type="<?= $arQuestion["STRUCTURE"]["0"]["FIELD_TYPE"] ?>" name="form_text_<?= $arQuestion["STRUCTURE"]["0"]["ID"] ?>" id="form-tel" placeholder="+7 (999) 999-99-99*"/>
- <? endif ?>
- </div>
- </div>
- <?
- } //endwhile
- ?>
- <? if ($arResult["isUseCaptcha"] == "Y") {?>
- <tr>
- <th colspan="2"><b><?= GetMessage("FORM_CAPTCHA_TABLE_TITLE") ?></b></th>
- </tr>
- <tr>
- <td> </td>
- <td><input type="hidden" name="captcha_sid"
- value="<?= htmlspecialcharsbx($arResult["CAPTCHACode"]); ?>"/><img
- src="/bitrix/tools/captcha.php?captcha_sid=<?= htmlspecialcharsbx($arResult["CAPTCHACode"]); ?>"
- width="180" height="40"/></td>
- </tr>
- <tr>
- <td><?= GetMessage("FORM_CAPTCHA_FIELD_TITLE") ?><span style="color: red;">*</span></td>
- <td><input type="text" name="captcha_word" size="30" maxlength="50" value="" class="inputtext"/>
- </td>
- </tr>
- <?
- } // isUseCaptcha
- ?>
- <input <?= (intval($arResult["F_RIGHT"]) < 10 ? "disabled=\"disabled\"" : ""); ?> type="submit" class="submit" id="submit" name="web_form_submit" value="<?= htmlspecialcharsbx(strlen(trim($arResult["arForm"]["BUTTON"])) <= 0 ? GetMessage("FORM_ADD") : $arResult["arForm"]["BUTTON"]); ?>"/>
- <div style="display: inline-block; margin-left: 15px;">
- <p style="margin-top: 10px;">
- <span style="color: red;">*</span> - <?= GetMessage("FORM_REQUIRED_FIELDS") ?>
- </p>
- </div>
- <div class="clearfix"></div>
- <? if ($_REQUEST['AJAX_REQUEST'] !== 'Y') {?>
- </form>
- <? } ?>
- <script>
- $(document).ready(function () {
- // Отправка AJAX запроса
- $('body').on('submit', '#card-form', function(e) { // Обработка отправки данных формыc
- e.preventDefault(); // Сброс стандартного обработчика формы
- formData = $(this).serialize() + "&web_form_submit=Заказать карту";
- // Сохраняем массив введенных данных включая значение кнопки "Отправить", без этого компонент Битрикса не примет данные
- $.ajax({
- method: "POST",
- url: $(this).attr('action') + '?AJAX_REQUEST=Y',
- data: {formData},
- dataType: "html",
- success: function( data ) {
- //var $data = $.parseHTML(data);
- $("#card-form").html(data);
- }
- });
- e.preventDefault();
- return false;
- });
- });
- </script>
- <? } //endif (isFormNote)?>
- </span>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement