Добрый день. Подскажите, почему не работает функция представленная в коде. Если убрать погрузку header, все начинает работать. В данной примере уходит в ветку if и выдает 'Пожалуйста, заполните все поля!';, соответственно не получает значений с формы.
Код |
---|
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Оплата");
?>
<st yle type="text/css">
body {
font: 14px/21px "Fira Sans", sans-serif;
}
.cash_form h2, .cash_form label {
font-family:Georgia, Times, "Fira Sans", serif;
}
.form_hint, .required_notification {font-size: 11px;}
.cash_form ul {
width:750px;
list-style-type:none;
list-style-position:outside;
margin:0px;
padding:0px;
}
.cash_form li{
padding:12px;
border-bottom:1px solid #eee;
position:relative;
}
.cash_form li:first-child, .cash_form li:last-child {
border-bottom:1px solid #777;
}
.cash_form h2 {
margin:0;
display: inline;
}
.required_notification {
color:#d45252;
margin:-10px 0 0 0;
display:inline;
float:right;
}
.cash_form label {
width:150px;
margin-top: 3px;
display:inline-block;
float:left;
padding:3px;
}
.cash_form input {
height:30px;
width:220px;
padding:5px 8px;
}
.cash_form textarea {padding:8px; width:300px;}
.cash_form button {margin-left:156px;}
.cash_form input, .cash_form textarea {
border:1px solid #aaa;
box-shadow: 0px 0px 3px #ccc, 0 10px 15px #eee inset;
border-radius:2px;
}
.cash_form input:focus, .cash_form textarea:focus {
background: #fff;
border:1px solid #555;
box-shadow: 0 0 3px #aaa;
}
.cash_form input:focus, .cash_form textarea:focus { /* add this to the already existing style */
padding-right:70px;
}
.cash_form input, .cash_form textarea { /* add this to the already existing style */
-moz-transition: padding .25s;
-webkit-transition: padding .25s;
-o-transition: padding .25s;
transition: padding .25s;
}
.cash_form input, .cash_form textarea {
padding-right:30px;
}
input:required, textarea:required {
background: #fff ;
}
::-webkit-validation-bubble-message {
padding: 1em;
}
.cash_form input:focus:invalid, .cash_form textarea:focus:invalid { /* when a field is considered invalid by the browser */
background: #fff ;
box-shadow: 0 0 5px #d45252;
border-color: #b03535
}
.cash_form input:required:valid, .cash_form textarea:required:valid { /* when a field is considered valid by the browser */
background: #fff ;
box-shadow: 0 0 5px #5cd053;
border-color: #28921f;
}
.form_hint {
background: #d45252;
border-radius: 3px 3px 3px 3px;
color: white;
margin-left:8px;
padding: 1px 6px;
z-index: 999; /* hints stay above all other elements */
position: absolute; /* allows proper formatting if hint is two lines */
display: none;
}
.form_hint::before {
content: "\25C0"; /* left point triangle in escaped unicode */
color:#d45252;
position: absolute;
top:1px;
left:-6px;
}
.cash_form input:focus + .form_hint {display: inline;}
.cash_form input:required:valid + .form_hint {background: #28921f;} /* change form hint color when valid */
.cash_form input:required:valid + .form_hint::before {color:#28921f;} /* change form hint arrow color when valid */
.error{
color: #d45252;
}
.pincode img{
width:775px;
margin: 0 auto;
position: relative;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
flex-direction: column;
overflow: hidden;
}
.info{
margin: 100px 0px 0px 0px;
position: relative;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
flex-direction: column;
overflow: hidden;
}
</style>
<div class="section main_section1">
<div class="container">
<div class="section13">
<div class="section4_row">
<div class="cash_form" id="cash_form" name="cash_form">
<ul>
<li> <span class="required_notification">* Обязательные поля</span> </li>
<li>
<div class="error" id="error">
</div>
</li>
<li> <label for="pin">PIN-код <sup> *</sup></label> <input type="text" id="pin" maxlength="11" required="" placeholder="XXXXXXXXXXX"> <span class="form_hint">не более 11 цифр</span> </li>
<li> <label for="cash">Сумма <sup> *</sup></label> <input type="number" id="cash" required=""> <span class="form_hint">10 - 14999 рублей</span> </li>
<li> <button type="submit" class="button button_themeLight popup_button" oncl ick="send()">Отправить</button> </li>
</ul>
</div>
<div class="info">
<p>
PIN-код можно узнать в квитанции об оплате интернет услуг, либо в <b><a href="https://stat.soskol.info/">личном кабинете</a></b>, а так же на странице <b><a href="http://soskol.com/abon/pincode">узнать ПИН-код</a></b>
</p>
<div class="pincode">
<img alt="ПИН-код" src="pincode.png">
</div>
</div>
</div>
</div>
</div>
</div>
<sc ript>
function send()
{
var err = document.getElementById('error');
err.style = 'display:none';
var pin = document.getElementById('pin').value;
var cash = document.getElementById('cash').value;
var node;
var pinchek;
node = pin.slice(-2,-1);
pinchek= pin.slice(-4,-2);
if(pin=='' || cash=='')
{
err.innerHTML = 'Пожалуйста, заполните все поля!';
err.style='display:block'
return false;
}
if(pinchek==09 || pinchek==01 || pinchek==14 || pinchek==08 || pinchek==11 || pinchek==18 || pinchek==17)
{
err.innerHTML = 'Введите корректный ПИН-код!';
err.style='display:block'
return false;
}
if(cash>14999 ||cash<10)
{
document.getElementById('error').innerHTML = 'Введите корректную сумму!';
err.style='display:block'
return false;
}
switch(node){
case '4':
window.location.href="https://www.paymentgateway.ru/?project=13644&source=6421&nickname="+pin.toString()+"&amount="+cash;
break;
case '5':
window.location.href="https://www.paymentgateway.ru/?project=13644&source=6421&nickname="+pin.toString()+"&amount="+cash;
break;
case '2':
window.location.href="https://www.paymentgateway.ru/?project=13638&nickname="+pin.toString()+"&amount="+cash;
break;
default:
document.getElementById('error').innerHTML = 'PIN-код введен некорректно!';
err.style='display:block'
break;
}
}
</sc ript>
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
|