501function t_form__checkFormWidth() {502if (window.innerWidth < 640) {503numberContainer.style.display = 'none';504} else {505numberContainer.style.display = 'block';506}507}508509// Validation step form510function t_form__checkOnError(activeForm, formScreen, currentScreen) {511var activeScreen = formScreen[currentScreen];512var arErrors = window.tildaForm.validate(activeScreen);
window.tildaForm.hideErrors(activeForm); var errorOnScreen; var errorsTypeObj = arErrors[0]; if (errorsTypeObj) { var errorType = errorsTypeObj.type[0]; errorOnScreen = errorType == 'emptyfill' ? false : window.tildaForm.showErrors(activeForm, arErrors); } return errorOnScreen; } function t_form__redrawCounterAndProgressbar(newActiveStep, newTotalSteps) { var currentNumberContainer = numberContainer.querySelector('.t-form__screen-number-current'); var totalNumberContainer = numberContainer.querySelector('.t-form__screen-number-total'); currentNumberContainer.innerHTML = newActiveStep; totalNumberContainer.innerHTML = newTotalSteps; var progressBar = rec.querySelector('.t-form__screen-progress-bar'); t_form__setProgressbar(progressBar, newActiveStep); } /** * Возвращает номер шага в счетчике. * Это +1 от его индекса * Если это условная форма, то индекс берется из списка активных шагов. * @returns {number} */ function t_form__getVisibleStepDisplayNumber() { // состояние хранится в индексах, отображаем + 1 if (conditionalStepForm) { return conditionalStepForm.getState().activePossibleStepIndex + 1; } return currentScreen + 1; } function t_form__isLastStep() { var stepNumber = t_form__getVisibleStepDisplayNumber(); return stepNumber === visibleStepsCount; } function t_form__isFirstStep() { var stepNumber = t_form__getVisibleStepDisplayNumber(); return stepNumber === 1; } function t_form__getNextStepIndex() { return conditionalStepForm ? conditionalStepForm.getState().nextStepIndex : currentScreen + 1; } function t_form__getPrevStepIndex() { return conditionalStepForm ? conditionalStepForm.getState().prevStepIndex : currentScreen - 1; } t_form__steps();}/* Lazy load form */function t_form__lazyLoad() { var allRecords = document.querySelector('#allrecords'); if (!allRecords) return; if (!allRecords.getAttribute('data-tilda-mode')) { if (window.lazy === 'y' || allRecords.getAttribute('data-tilda-lazy') === 'yes') { t_form__onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } }}/** * Launches the function as soon as it is ready * @param {string} funcName - str fn for start * @param {Function} okFunc - execution function * @param {number} time - time for setTimeout */function t_form__onFuncLoad(funcName, okFunc, time) { if (typeof window[funcName] === 'function') { okFunc(); } else { setTimeout(function checkFuncExist() { if (typeof window[funcName] === 'function') { okFunc(); return; } if (document.readyState === 'complete' && typeof window[funcName] !== 'function') { throw new Error(funcName + ' is undefined'); } setTimeout(checkFuncExist, time || 100); }); }