jquery.validation() - 验证工作但没有提交

时间:2013-02-18 13:38:03

标签: javascript jquery validation

我遇到过jQuery.validation方法工作的奇怪情况 - 验证表单,但由于某些原因阻止表单提交,即使满足所有必需条件。

表单HTML和JS:

<div id="createcustomer">
<form method="POST" action="http://localhost/actionurl..." id="create-customer-form">
    <div class="input-table">
        <div class="input-row">
            <div class="input-cell-label" >
                Skrót (Kod)
            </div>
            <div class="input-cell">
                <input type="text" id="input-shortname" name="shortname" class="required" maxlength="25" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Pełna nazwa
            </div>
            <div class="input-cell">
                <input type="text" id="input-fullname" name="fullname" class="required" maxlength="255" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Adres
            </div>
            <div class="input-cell">
                <input type="text" id="input-address" name="address" class="" maxlength="90" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Kod pocztowy
            </div>
            <div class="input-cell">
                <input type="text" id="input-postal_code" name="postal_code" class="" maxlength="6" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Miasto
            </div>
            <div class="input-cell">
                <input type="text" id="input-city" name="city" class="" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Państwo
            </div>
            <div class="input-cell">
                <input type="text" id="input-country" name="country" class="required" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Telefon
            </div>
            <div class="input-cell">
                <input type="text" id="input-phone" name="phone" class="" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Faks
            </div>
            <div class="input-cell">
                <input type="text" id="input-fax" name="fax" class="" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Email
            </div>
            <div class="input-cell">
                <input type="text" id="input-email" name="email" class="" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell-label" >
                Strona www
            </div>
            <div class="input-cell">
                <input type="text" id="input-website" name="website" class="" maxlength="45" value="" />
            </div>                    
        </div>
        <div class="input-row">
            <div class="input-cell" >
            </div>
            <div class="input-cell" >
                <input type="submit" name="submit_create" value="Utwórz" class="submit"/><input type="Reset" value="Wyczyść" />
            </div>
        </div>
    </div>
</form>

<script>



$(function(){ 

    $("#create-customer-form").validate();

});

$(document).ready(function(){

});

没有错误信息,萤火虫没有错误,没有任何错误。 JS工作稳定。我试图简化它并尝试只有1个输入字段 - 相同的结果。表单完美无缺,无需验证方法。

这是如何引起的?如何解决?

1 个答案:

答案 0 :(得分:1)

不确定它是否适合您,只需尝试:

$(document).ready(function(){
   $("#create-customer-form").validate({
   submitHandler: function(form) {
   form.submit();
   }
 });
});