repair telephone
This commit is contained in:
parent
0c6b73754f
commit
a3b91c792a
3 changed files with 38 additions and 5 deletions
|
@ -202,10 +202,15 @@ function sendVerificationCode() {
|
|||
|
||||
/** Управляет отображением блока с полями программы лояльности на странице регистрации. */
|
||||
function lpFieldToggle() {
|
||||
let phone = $('#personalPhone');
|
||||
if ($('#checkbox_UF_REG_IN_PL_INTARO').is(':checked')) {
|
||||
$('.lp_toggled_block').css('display', 'table-row');
|
||||
$('.lp_agree_checkbox').prop('checked', true);
|
||||
phone.prop('type', 'tel');
|
||||
phone.attr('name', 'REGISTER[PERSONAL_PHONE]');
|
||||
} else {
|
||||
phone.removeAttr('name');
|
||||
phone.prop('type', 'hidden');
|
||||
$('.lp_agree_checkbox').prop('checked', false);
|
||||
$('.lp_toggled_block').css('display', 'none');
|
||||
}
|
||||
|
|
|
@ -202,10 +202,15 @@ function sendVerificationCode() {
|
|||
|
||||
/** Управляет отображением блока с полями программы лояльности на странице регистрации. */
|
||||
function lpFieldToggle() {
|
||||
let phone = $('#personalPhone');
|
||||
if ($('#checkbox_UF_REG_IN_PL_INTARO').is(':checked')) {
|
||||
$('.lp_toggled_block').css('display', 'table-row');
|
||||
$('.lp_agree_checkbox').prop('checked', true);
|
||||
phone.prop('type', 'tel');
|
||||
phone.attr('name', 'REGISTER[PERSONAL_PHONE]');
|
||||
} else {
|
||||
phone.removeAttr('name');
|
||||
phone.prop('type', 'hidden');
|
||||
$('.lp_agree_checkbox').prop('checked', false);
|
||||
$('.lp_toggled_block').css('display', 'none');
|
||||
}
|
||||
|
@ -240,6 +245,11 @@ function mask(e) {
|
|||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
const input = document.querySelector("#personalPhone");
|
||||
|
||||
if (input === null) {
|
||||
return
|
||||
}
|
||||
|
||||
input.addEventListener("input", mask, false);
|
||||
input.focus();
|
||||
setCursorPosition(3, input);
|
||||
|
|
|
@ -98,7 +98,25 @@ if ($arResult["SHOW_SMS_FIELD"] == true) {
|
|||
<form id="lpRegFormInputs">
|
||||
<?php
|
||||
foreach ($arResult['LP_REGISTER']['form']['fields'] as $key => $field) {
|
||||
?>
|
||||
|
||||
if ($key === 'PERSONAL_PHONE') { ?>
|
||||
<label>
|
||||
<?=GetMessage($key)?>:
|
||||
<input
|
||||
id="personalPhone"
|
||||
autofocus="autofocus"
|
||||
required="required"
|
||||
pattern="([\+]*[0-9]{1}\s?[\(]*[0-9]{3}[\)]*\s?\d{3}[-]*\d{2}[-]*\d{2})"
|
||||
placeholder="+_(___)___-__-__"
|
||||
value="+_(___)___-__-__"
|
||||
size="30"
|
||||
type="tel"
|
||||
>
|
||||
</label>
|
||||
<?php
|
||||
continue;
|
||||
} ?>
|
||||
|
||||
<label>
|
||||
<input
|
||||
name="<?=$key?>"
|
||||
|
@ -454,13 +472,13 @@ if ($arResult["SHOW_SMS_FIELD"] == true) {
|
|||
<td>
|
||||
<input
|
||||
id="personalPhone"
|
||||
autofocus="autofocus" required="required"
|
||||
value="+_(___)___-__-__"
|
||||
autofocus="autofocus"
|
||||
required="required"
|
||||
pattern="([\+]*[0-9]{1}\s?[\(]*[0-9]{3}[\)]*\s?\d{3}[-]*\d{2}[-]*\d{2})"
|
||||
placeholder="+_(___)___-__-__"
|
||||
value="+_(___)___-__-__"
|
||||
size="30"
|
||||
type="tel"
|
||||
name="REGISTER[PERSONAL_PHONE]"
|
||||
type="hidden"
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue