i have validation on form, 1 field. deals phone number:
<form action="/cabinet/company/get_money.php" method="post" class="form-inline" id="get-balans"> <label for="phone" class="p10"><strong>Контактный телефон для связи с Вами:</strong></label> <div class="row"> <div class="col-md-2"> <div class="section"> <label class="field prepend-icon"> <input type="text" name="phone" id="phone" data-msg-minlength="Укажите пожалуйста телефон полностью" value="<?=$aruser['work_phone']?>" class="gui-input" data-rule-minlength="8" data-rule-required="true" data-msg-required="Укажите пожалуйста телефон полностью"> <label for="org_name" class="field-icon"> <i class="fa fa-phone"></i> </label> </label> </div> </div> <div class="col-md-3"> <input type="submit" name="send" class="btn btn-system" value="Запросить пополнение баланса"> </div> <div class="col-md-7 text-right"> <a href="/register/premium.php" class="btn btn-system" style="margin-right: 20px">Тарифы на премиальные услуги</a> </div> </div> </form>
validation handles jquery validation plugin:
$(function(){ $("#phone").mask("+7 (999) 999-9999"); var form = $("#get-balans"); form.validate({ errorclass: "state-error", validclass: "state-success", errorelement: "em", rules: { confirm: { equalto: "#password" }, }, highlight: function(element, errorclass, validclass) { $(element).closest('.field').addclass(errorclass).removeclass(validclass); $(element).closest('.input-group').addclass(errorclass).removeclass(validclass); }, unhighlight: function(element, errorclass, validclass) { $(element).closest('.field').removeclass(errorclass).addclass(validclass); $(element).closest('.input-group').removeclass(errorclass).addclass(validclass); }, errorplacement: function(error, element) { if (element.is(":radio") || element.is(":checkbox")) { element.closest('.option-group').after(error); } else { error.insertafter(element.parent()); } } }); $("#get-balans").submit(function(){ form.validate(); return form.valid(); }) });
the problem in firefox mozilla (the newest version), skips validation , send form after multiple pressing on button. how can fix it?
Comments
Post a Comment