D
D
Dmitry2016-08-23 20:32:23
JavaScript
Dmitry, 2016-08-23 20:32:23

Why is form validation not working on github page?

UPD: Changed question title I'm
using jQuery validationEngine. On a locale everything works fine, the form is checked for conditions. Transferred to a hosting (github page) and the check stopped working. What could be the problem? On normal hosting everything works

<form id="contact-form">

  <div class="contact-form_input-container">
    <input class="contact-form_input validate[required,minSize[4]]" id="contact-name" type="text" name="Name">
    <label class="contact-form_label" for="first_name">Имя</label>
  </div>

  <div class="contact-form_input-container">
    <input class="contact-form_input validate[required, custom[email]]" id="contact-email" type="email" name="E-mail">
    <label class="contact-form_label" for="email">E-mail</label>
  </div>

  <div class="contact-form_textarea-container">
    <textarea class="contact-form_input validate[required,minSize[20]]" name="Message" id="contact-text" cols="30" rows="5"></textarea>
    <label class="contact-form_label" for="text_message">Сообщение</label>
  </div>

  <div class="contact-form_submit-container">
    <input class="contact-form_submit" type="submit" value="Отправить" name="submit" id="send">
  </div>

</form>
$("#contact-form").validationEngine('attach',{
  promptPosition : "bottomLeft", maxErrorsPerField : 1,
  showArrow : false, 'custom_error_messages':{
    '#contact-name' : {
      'required' : {
        'message' : "* Это поле обязательно."
      },
      'minSize' : {
        'message' : "* Слишком коротко."
      }
    },
    '#contact-email' : {
      'required' : {
        'message' : "* Это поле обязательно."
      },
      'custom[email]' : {
        'message' : "* Тут где-то ошибка."
      }
    },
    '#contact-text' : {
      'required' : {
        'message' : "* Это поле обязательно."
      },
      'minSize' : {
        'message' : "* Нужно чуть больше слов."
      }
    }
  }
});


$('#contact-form').submit(function(e) {
    e.preventDefault();
    $.ajax({
      url: 'https://formspree.io/[email protected]', 
  		method: 'POST',
  		data: $(this).serialize(),
  		dataType: 'json'
    }).done(function() {
      setTimeout(function() {
        $('#contact-form').trigger('reset');
      }, 2200);
    });
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mr Hobot, 2016-08-23
@vashaaa

It's most likely a jQuery connection issue. You would have thrown off the whole code to look, otherwise it’s not clear a damn thing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question