I am beginner web developer.
I have webpage with dynamic create search forms:
<form action="{{ pageTemplate.pageHeader.webUrl |raw }}ListaStron/Wszystkie" method="get" name="contactformXX" aria-hidden="false"
class="form validate clearfix validate-formX clickForm validate-formXXX1">
<div class="form-group ">
<div class="form-group has-feedback ">
<input required="required" name="query" type="text" class="form-control indexInputSzukaj input_id1"
id="input_id1"
placeholder="Znajdź" value="{{ pageTemplate.pageHeader.pageValue.searchQuery }}"/>
<button type="submit" class="form-control-feedbackXX glyphiconColor showActionAfterClick searchBtnSUbmit1" style="background-color: transparent;border: 0;top:2px" >
<span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
</form>
Sometimes I have 1 or more this form on one view.
I have validate code:
$('.searchBtnSUbmit1').click(function (e) {
e.preventDefault();
$('#.validate-formXXX1 input[type="text"]').blur(function () {
alert('1');
if (document.getElementsByClassName("input_id1").value.length == 0) {
e.preventDefault();
alert('Proszę uzupełnić poprawnie wszystkie wymagane pola formularza!');
} else {
form.submit();
}
});
});
But it’s not working 🙁 How can I repair it?