Answer the question
In order to leave comments, you need to log in
How can I remove the mandatory fields in the form?
Please tell me what needs to be changed in the code so that the fields (Organization, Contact person, City, Message) are optional.
Studio code
<?
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
$APPLICATION->SetTitle("");
global $USER;
if ($USER->isAdmin() ) {
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
} else {
LocalRedirect(SITE_DIR);
die();
}
}
define('NO_AGENT_CHECK', true);
define("STOP_STATISTICS", true);
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
?><?
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
global $USER;
if ($USER->isAdmin() ) {
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
} else {
LocalRedirect(SITE_DIR);
die();
}
}
define('NO_AGENT_CHECK', true);
define("STOP_STATISTICS", true);
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
?>
<div class="tab-content clearfix" id="ajax-mode__order-form">
<form id="order-form" class="ajax-mode__order-form">
<h2>Заказать расчет оборудования</h2>
<div class="order-form__field-wrapper"><label>Организация:<span class="required-marker">*</span></label><input id="order-form__company" class="sm-form-control" type="text"></div>
<div class="order-form__field-wrapper"><label>Телефон:<span class="required-marker">*</span></label><input id="order-form__tel" class="sm-form-control" type="tel"></div>
<div class="order-form__field-wrapper"><label>Контактное лицо:<span class="required-marker">*</span></label><input id="order-form__person" class="sm-form-control" type="text"></div>
<div class="order-form__field-wrapper"><label>Город:<span class="required-marker">*</span></label><input id="order-form__city" class="sm-form-control" type="text"></div>
<div class="order-form__field-wrapper"><label>E-mail:<span class="required-marker">*</span></label><input id="order-form__email" class="sm-form-control" type="email"></div>
<div class="clear-both"></div>
<div class="order-form__field-wrapper order-form__message"><label>Сообщение:<span class="required-marker">*</span></label><textarea id="order-form__message" class="sm-form-control" rows="5"></textarea></div>
<div class="clear-both"></div>
<div class="style-msg infomsg mb10">
<div class="sb-msg"><i class="icon-info-sign"></i><strong>Обратите внимание!</strong> Если у Вас есть техническое задание, пожалуйста, прикрепите файл или архив с файлами.</div>
</div>
<div class="order-form__field-wrapper order-form__file">
<label>Прикрепить файл</label>
<input id="order-form__file-value" type="file">
<div id="order-form__file-load" style="display: none;">
<span style="margin-bottom: 5px;">Файл загружается...</span><br>
<img src="/include/images/file-load.gif" style="margin-bottom: 15px;">
</div>
</div>
<div class="order-form__field-wrapper order-form__recaptcha"><label>Защита от автоматических сообщений:<span class="required-marker">*</span></label><div class="g-recaptcha" data-sitekey="6LdRfh0UAAAAAJLNr7AoF1Z0i83zBOQjpZdF1QTz"></div></div>
<div class="clear-both"></div>
<div class="order-form__field-wrapper order-form__recaptcha-error"><label></label><span>Подтвердите, что Вы не робот</span></div>
<div class="order-form__field-wrapper order-form__submit"><label></label><input id="order-form__submit" class="button" type="submit"></div>
</form>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script src="<?=SITE_TEMPLATE_PATH.'/js/order-form.js'?>"></script>
</div>
<?
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
global $USER;
if ($USER->isAdmin() ) {
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php");
}
}
Answer the question
In order to leave comments, you need to log in
Removing the span will not help, I suspect that the form is sent by Ajax using javascript, and it is validated with the help of it.
order-form.js - you need to see what's in this file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question