Задать вопрос
@Gambi-Titto
Начинающий програмист

Как перенаправлять на другую страницу при успешной валидации формы?

<script type="text/javascript">var submitted=false;</script>
        <iframe name="hidden_iframe" id="hidden_iframe"
        style="display:none;" ></iframe>
        <form  action="https://docs.google.com/forms/d/e/1FAIpQLSf2-cgXtTGc_fOStLJTeSA8XBnWcwPQEkYG8PuxZFAusICfyw/formResponse"  
        method="post"
        target="hidden_iframe" onsubmit="submitted=true;" class="pb-1 mb-4 main-form needs-validation" id="feedback-form" >

      
            <div class="text-center pt-4"><img src="img/Logo-Atomy.png" width="110px" height="100px"></div>
            <div class="row  justify-content-center">
            <h4 class="text-center p-3">Предверификация</h4>
            </div>

            <div class="form-group">
            <div class="col-sm-12">
            <input type="number" class="form-control" id="idnumber" aria-describedby="i.desc.2065253458 i.err.2065253458" name="entry.164893481" placeholder="Ваш ID"  x-autocompletetype="idnumber" onkeyup="check();">
            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
            </div>
            </div>

            <div class="form-group">
            <div class="col-sm-12">
            <input type="text" class="form-control" id="fio" aria-describedby="i.desc.1047509474 i.err.1047509474" name="entry.1696565046" placeholder="ФИО" required x-autocompletetype="fio" onkeyup="check();">
            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
           </div>
           </div>
            <div class="form-group">
            <div class="col-sm-12">
            <input type="tel" class="form-control" id="phone" name="phone" placeholder="Телефон" required  x-autocompletetype="phone" onkeyup="check();">
            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
            </div>
            </div>
            
            <div class="form-group">
            <div class="col-sm-12">
            <input type="email" class="form-control" id="contactFF" x-autocompletetype="email" name="contactFF" placeholder="Email" required onkeyup="check();">
            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
            </div>
            </div>
            
            <div class="form-group">
            <div class="col-sm-12">
            <input type="number" class="form-control" id="idnumber-s" name="idnumber-s" placeholder="ID Спонсора" required x-autocompletetype="idnumber" onkeyup="check();">
            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
            </div>
            </div>

  <!-- The Modal -->
  <div class="container row">
  <div class="form-check">
  <div class="form-check form-check-inline">
    <input class="form-check-input" type="checkbox" id="inlineCheckbox1" required value="option1" >
    <a href="#" data-toggle="modal" data-target="#myModal">Я соглашаюсь с условиями предверификации</a>
    <label class="form-check-label" for="inlineCheckbox1"></label>
  </div>
  </div>

    <!-- Button to Open the Modal -->
    <!-- The Modal -->
    <div class="modal pt-5" id="myModal">
    <div class="modal-dialog modal-dialog-scrollable">
    <div class="modal-content">
        
            <div class="form-group button-1">
            <div class="col-sm-offset-2 col-sm-6">            
            <button type="submit"id="submitFF" class="btn btn-success col" value="Отправить" disabled="disabled" onclick="Ohran1()">Отправить</button>
            </div>
            </div>  
            </form> 
    </div>
  </div>
</div>
</div>
</div>


var form = document.querySelector('.needs-validation');
form.addEventListener('submit', function(event) {
    if (form.checkValidity() === false) {
        event.preventDefault();
        event.stopPropagation();
    }
    form.classList.add('was-validated');
})
function check() {
  var inp1 = document.getElementById('idnumber'),
      inp2 = document.getElementById('fio'),
      inp3 = document.getElementById('phone'),
      inp4 = document.getElementById('contactFF'),
      inp5 = document.getElementById('idnumber-s');
  document.getElementById('submitFF').disabled = inp1.value  && inp2.value && inp3.value && inp4.value && inp5.value ? false : "disabled";
}
  • Вопрос задан
  • 141 просмотр
Подписаться 1 Средний Комментировать
Решения вопроса 1
OTCloud
@OTCloud
Программирование и Архитектура ПО
window.location.href = "https://some_link.here/to/go/there"
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы