Array.prototype.forEach.call(inputs, function (input) {
114 input.addEventListener('keypress', function (event) { 115 var activeStep = form.querySelector('.t-step-form__step_active'); 118 (event.code === 'Enter' || event.keyCode === 13) && 119 !form.classList.contains('js-form-proccess') && 120 !activeStep.querySelector('.t-input-group_ta') 122 handleGoNextStep(event); 127 resultBtn.addEventListener('click', function (event) { 128 handleGoNextStep(event); 131 // В tilda-forms обработка клика на submit реализована через click на блок целиком. 132 rec.addEventListener('click', function (event) { 133 var target = event.target; 134 var btnSubmit = target.closest('[type="submit"]') ? target : false; 135 if (!btnSubmit) return; 136 // Обновляем высоту при нажатии на submit, чтобы в случае появления ошибок установить актуальную высоту 137 t835_adjustStepToHeight(rec); 140 // пересчитывает высоту на изменения ширины экрана 141 t835_adjustHeightOnResize(rec); 145 function handleGoPrevStep(event) { 146 if (stepChangeInProgress) return; 147 event.preventDefault(); 148 resetAutoStepChangeProgress(); 150 if (checkFirstStep()) return; 152 quizStepIndex = conditionalStepForm ? conditionalStepForm.getState().prevStepIndex : getActiveStepIndex() - 1; 154 if (conditionalStepForm) { 155 conditionalStepForm.onStepChange(quizStepIndex); 158 progressValue = updateProgressValue(); 159 t835_setProgress(rec, progressValue.progressCurrentStep, progressValue.progressAllSteps); 160 t835_showCounter(rec, progressValue.counterCurrentStep, progressValue.counterAllSteps); 162 t835_awayFromResultScreen(rec); 163 t835_hideError(rec, quizStepIndex); 164 t835_disabledPrevBtn(rec, quizStepIndex); 165 showStep(quizStepIndex); 166 t835_scrollToTop(quizWrapper); 168 if (form.classList.contains('js-form-proccess')) { 169 form.classList.remove('js-form-proccess'); 173 function handleGoNextStep(event) { 174 if (stepChangeInProgress) return; 175 event.preventDefault(); 176 resetAutoStepChangeProgress(); 178 var showErrors = t835_showError(rec, quizWrapper, quizStepIndex); 179 if (showErrors && errorBoxMiddleWrapper) { 180 errorBoxMiddleWrapper.style.display = 'none'; 182 if (showErrors) return; 184 var isCurrentStepLast = checkLastStep(); 186 quizStepIndex = conditionalStepForm ? conditionalStepForm.getState().nextStepIndex : getActiveStepIndex() + 1; 188 if (conditionalStepForm) { 189 conditionalStepForm.onStepChange(quizStepIndex); 192 progressValue = updateProgressValue(); 193 t835_setProgress(rec, progressValue.progressCurrentStep, progressValue.progressAllSteps); 194 t835_showCounter(rec, progressValue.counterCurrentStep, progressValue.counterAllSteps); 196 t835_disabledPrevBtn(rec, quizStepIndex); 198 if (isCurrentStepLast && hasCaptureForm) {