Привет. Я только недавно в Битриксе. Прошу помощи.
Есть такая форма:
Код |
---|
<?php
if(!defined("B_PROLOG_INCLUDED")||B_PROLOG_INCLUDED!==true)die();
/**
* Bitrix vars
*
* @var array $arParams
* @var array $arResult
* @var CBitrixComponentTemplate $this
* @global CMain $APPLICATION
* @global CUser $USER
*/
echo "<div id=\"feedback{$arParams["INFRASTRUCTURE"]}\">";
// TITLE
echo "<div st yle=\"display:none\" class=\"pad vpad ico_pic_32a_reserv ico_pos_32_top\">";
echo "<h1 class=\"text-m-center\">".GetMessage("IP_FR_T_TITLE")."</h1>";
echo "</div>";
// OK
if($arResult["OK"] == "Y") {
echo "
<div class=\"pad vpad2 text-m-center\">
<p>".GetMessage("IP_FR_T_OK")."</p>
</div>";
}
// FORM
else {
echo "<fo rm action=\"{$APPLICATION->GetCurPage()}\" method=\"POST\">";
echo bitrix_sessid_post();
// INFRASTRUCTURE
echo "<h2 st yle=\"display:none\" class=\"pad text-m-center\">— {$arResult["INFRASTRUCTURE"]} —</h2>";
echo "<div class=\"cell-m-100\">";
// DATE_FROM
echo "<div st yle=\"display:none\" class=\"cell-m-100 cell-t-50 pad vpad".(isset($arResult["ERROR_MESSAGE"]["DATE_FROM"])?" ajax_return":"")."\">";
// label
echo "<label>".GetMessage("IP_FR_T_DATE_FROM");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("DATE_FROM", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["DATE_FROM"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["DATE_FROM"]}</span>";
unset($arResult["ERROR_MESSAGE"]["DATE_FROM"]);
}
echo "</label>";
// input
echo "<input class=\"fc-calendar-input ico_pic_32b_calendar ico_pos_32_right cell-m-100 border-all-1 pad vpad popup\" type=\"text\" name=\"DATE_FROM\" value=\"{$arResult["DATE_FROM"]}\">";
// popup
echo "<div class=\"cell-m-100 cell-t-50 mar-t-25 cell-d-37-5 mar-d-31-25 hidden bg-1\">";
echo "<input type=\"hidden\" name=\"fc-calendar-month\" value=\"".GetMessage("IP_FR_T_MONTH")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-monthabbr\" value=\"".GetMessage("IP_FR_T_MONTH_ABBR")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-week\" value=\"".GetMessage("IP_FR_T_WEEK")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-weekabbr\" value=\"".GetMessage("IP_FR_T_WEEK_ABBR")."\" />";
echo "<div class=\"row bg-2 vpad\">";
echo "<a href=\"#\" class=\"fc-calendar-prev link-block cell-m-25 ico_pic_32b_left ico_pos_center\" st yle=\"height: 32px;\"></a>";
echo "<div class=\"fc-calendar-monthyear cell-m-50 text-m-center large\"></div>";
echo "<a href=\"#\" class=\"fc-calendar-next link-block cell-m-25 ico_pic_32b_right ico_pos_center\" st yle=\"height: 32px;\"></a>";
echo "</div>";
echo "<div class=\"fc-calendar-container vpad\"></div>";
echo "</div>";
echo "</div>";
// DATE_TO
echo "<div st yle=\"display:none\" class=\"cell-m-100 cell-t-50 pad vpad".(isset($arResult["ERROR_MESSAGE"]["DATE_TO"])?" ajax_return":"")."\">";
// label
echo "<label>".GetMessage("IP_FR_T_DATE_TO");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("DATE_TO", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["DATE_TO"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["DATE_TO"]}</span>";
unset($arResult["ERROR_MESSAGE"]["DATE_TO"]);
}
echo "</label>";
// input
echo "<input class=\"fc-calendar-input ico_pic_32b_calendar ico_pos_32_right cell-m-100 border-all-1 pad vpad popup\" type=\"text\" name=\"DATE_TO\" value=\"{$arResult["DATE_TO"]}\">";
// popup
echo "<div class=\"cell-m-100 cell-t-50 mar-t-25 cell-d-37-5 mar-d-31-25 hidden bg-1\">";
echo "<input type=\"hidden\" name=\"fc-calendar-month\" value=\"".GetMessage("IP_FR_T_MONTH")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-monthabbr\" value=\"".GetMessage("IP_FR_T_MONTH_ABBR")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-week\" value=\"".GetMessage("IP_FR_T_WEEK")."\" />";
echo "<input type=\"hidden\" name=\"fc-calendar-weekabbr\" value=\"".GetMessage("IP_FR_T_WEEK_ABBR")."\" />";
echo "<div class=\"row bg-2 vpad\">";
echo "<a href=\"#\" class=\"fc-calendar-prev link-block cell-m-25 ico_pic_32b_left ico_pos_center\" st yle=\"height: 32px;\"></a>";
echo "<div class=\"fc-calendar-monthyear cell-m-50 text-m-center large\"></div>";
echo "<a href=\"#\" class=\"fc-calendar-next link-block cell-m-25 ico_pic_32b_right ico_pos_center\" st yle=\"height: 32px;\"></a>";
echo "</div>";
echo "<div class=\"fc-calendar-container vpad\"></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class=\"cell-m-100\">";
// AUTHOR
echo "<div st yle=\"display:none\" class=\"cell-m-100 cell-t-50 pad vpad".(isset($arResult["ERROR_MESSAGE"]["AUTHOR"])?" ajax_return":"")."\">";
// label
echo "<label>".GetMessage("IP_FR_T_AUTHOR");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("AUTHOR", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["AUTHOR"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["AUTHOR"]}</span>";
unset($arResult["ERROR_MESSAGE"]["AUTHOR"]);
}
echo "</label>";
// input
echo "<input class=\"cell-m-100 border-all-1 pad vpad\" type=\"text\" name=\"AUTHOR\" value=\"{$arResult["AUTHOR"]}\">";
echo "</div>";
// PHONE
echo "<div class=\"mf-email".(isset($arResult["ERROR_MESSAGE"]["PHONE"])?" ajax_return":"")."\">";
// label
echo "<div class=\"mf-text\">".GetMessage("IP_FR_T_PHONE");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("PHONE", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["PHONE"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["PHONE"]}</span>";
unset($arResult["ERROR_MESSAGE"]["PHONE"]);
}
echo "</div>";
// input
echo "<input onke yup=\"checkParams()\" autocomplete=\"off\" type=\"tel\" id=\"Reserve_tel\" name=\"PHONE\" pattern=\"^((\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{10}\" value=\"{$arResult["PHONE"]}\">";
echo "</div>";
echo "</div>";
echo "<div class=\"cell-m-100\">";
// EMAIL
echo "<div st yle=\"display:none\" class=\"cell-m-100 cell-t-50 pad vpad".((isset($arResult["ERROR_MESSAGE"]["EMAIL"]) || isset($arResult["ERROR_MESSAGE"]["EMAIL_INVALID"]))?" ajax_return":"")."\">";
// label
echo "<label>".GetMessage("IP_FR_T_EMAIL");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("EMAIL", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["EMAIL"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["EMAIL"]}</span>";
unset($arResult["ERROR_MESSAGE"]["EMAIL"]);
} elseif(isset($arResult["ERROR_MESSAGE"]["EMAIL_INVALID"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["EMAIL_INVALID"]}</span>";
unset($arResult["ERROR_MESSAGE"]["EMAIL_INVALID"]);
}
echo "</label>";
// input
echo "<input class=\"cell-m-100 border-all-1 pad vpad\" type=\"text\" name=\"EMAIL\" value=\"{$arResult["EMAIL"]}\">";
echo "</div>";
// TEXT
echo "<div st yle=\"display:none\" class=\"cell-m-100 cell-t-50 pad vpad".((isset($arResult["ERROR_MESSAGE"]["TEXT"]))?" ajax_return":"")."\">";
// label
echo "<label>".GetMessage("IP_FR_T_TEXT");
if (empty($arParams["REQUIRED_FIELDS"]) || in_array("TEXT", $arParams["REQUIRED_FIELDS"])){
echo "*";
}
if(isset($arResult["ERROR_MESSAGE"]["TEXT"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["TEXT"]}</span>";
unset($arResult["ERROR_MESSAGE"]["TEXT"]);
}
echo "</label>";
// input
echo "<input class=\"cell-m-100 border-all-1 pad vpad\" type=\"text\" name=\"TEXT\" value=\"{$arResult["TEXT"]}\">";
//echo "<textarea class=\"cell-m-100 border-all-1 pad vpad\" rows=\"2\" name=\"TEXT\">{$arResult["TEXT"]}</textarea>";
echo "</div>";
echo "</div>";
// CAPTCHA
if ($arParams["USE_CAPTCHA"] == "Y") {
echo "<div class=\"cell-m-100 pad vpad".((isset($arResult["ERROR_MESSAGE"]["CAPTHCA_EMPTY"]) || isset($arResult["ERROR_MESSAGE"]["CAPTCHA_WRONG"])) ? " ajax_return":"")."\">";
// label
echo "<label class=\"cell-m-100\">".GetMessage("IP_FR_T_CAPTCHA")."*";
if(isset($arResult["ERROR_MESSAGE"]["CAPTHCA_EMPTY"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["CAPTHCA_EMPTY"]}</span>";
unset($arResult["ERROR_MESSAGE"]["CAPTHCA_EMPTY"]);
} elseif (isset($arResult["ERROR_MESSAGE"]["CAPTCHA_WRONG"])) {
echo "<span st yle=\"color: red;\"> — {$arResult["ERROR_MESSAGE"]["CAPTCHA_WRONG"]}</span>";
unset($arResult["ERROR_MESSAGE"]["CAPTCHA_WRONG"]);
}
echo "</label>";
// input
echo "<input class=\"cell-m-50 border-all-1 pad vpad\" type=\"text\" name=\"captcha_word\" value=\"\" maxlength=\"50\">";
echo "<img src=\"/bitrix/tools/captcha.php?captcha_sid={$arResult["capCode"]}\" width=\"180\" height=\"40\" alt=\"CAPTCHA\" />";
echo "<input type=\"hidden\" name=\"captcha_sid\" value=\"{$arResult["capCode"]}\">";
echo "</div>";
}
echo "</div>";
echo "<div class=\"cell-m-100 row\">";
// ERROR
if(!empty($arResult["ERROR_MESSAGE"])) {
foreach($arResult["ERROR_MESSAGE"] as $v) {
echo "<p class=\"pad text-m-center ajax_return\" st yle=\"color: red;\">{$v}</p>";
}
}
// SUBMIT
echo "<div class=\"pad vpad\">";
echo "<input type=\"hidden\" name=\"PARAMS_HASH\" value=\"{$arResult["PARAMS_HASH"]}\">";
echo "<input type=\"hidden\" name=\"submit\" value=\"submit\">";
echo "<button id=\"submit\" type=\"submit\" value=\"".GetMessage("IP_FR_T_SUBMIT")."\">".GetMessage("IP_FR_T_SUBMIT")."</button>";
echo "</div>";
echo "</form>";
} // FORM
echo "</div>";
?>
|
У телефона проверка на обязательное поле. При ошибке появляется надпись, что поле обязательное.
Как можно сделать, чтобы к кнопке submit добавлялось disabled, если телефон не заполнен.
Спасибо.