English 中文(简体)
jquery.validation required not prevent postback
原标题:jquery.validation required not stopping postback

我正在利用“ j子”鉴定,试图使用户在满足多种条件的前提下不退位。 但是,所要求的选择似乎并没有保留提交的形式。

http://jsfiddle.net/5NCQg/2/“rel=“nofollow”jsFiddle

我把检查我的酒吧法典翻了一番,似乎正在发挥作用。 jsFiddle说是有效的法典。 因此,我不敢肯定hang死是什么?

增 编

最佳回答

j Query.validate use name for the Rules, not ids. 因此,用贵投入领域的名称取代女胎。

您的表格还应如下:<form id=“temp1”>,而不是<form id=“#temp”>

http://jsfiddle.net/5NCQg/5/“rel=“nofollow”

<form id="temp1">
    <input type="text" name="HospitalFinNumber"/> Hospital Fin<br/>
    <input type="text" name="DateOfBirth"/>Date of Birth<br/>
    <input type="text" name="AdmitDate"/>Admit Date<br/>
    <input type="text" name="Comment"/>Comment<br/>
    <input type="submit" value="Save" class="button" id="btClick"/>
</form>

$(document).ready(function () {
    $("#temp1").validate({
        rules: {
            HospitalFinNumber: {
                required: true,
                minlength: 6
            },
            DateOfBirth: {
                required: true
            },
            AdmitDate: {
                required: true
            },
            Comment: {
                required: function (element) {
                    return $(element).val().length < 4000;
                },
                maxlength: 4000
            }
        },
        messages: {
            HospitalFinNumber:  Please Enter a Hospital Fin number ,
            DateOfBirth:  Please enter a valid Date Of Birth ,
            AdmitDate:  Please select an Admit Date ,
            Comment:  Why dont you stop attempting to put in more than 4000 characters?  Thanks... 
        }
    });
});
问题回答

暂无回答




相关问题
submitHandler doesn t work

The following code doesn t work. $(document).ready(function(){ $("#digitalchange").validate( { rules: { addbalance: { digits:true, ...

Dependency mismatch with Jquery Validate plugin

I am pretty new to Jquery, I am using validation rule against my textbox. The problem is when i mark textbox is mandatory n user doesn t input any value then it doesn t show any validation message. I ...

jQuery - Getting custom validation methods to trigger

If I ve added a custom validation method to my form, how can I get it to trigger prior to submit? I m not decorating my form fields but I thought that adding the new method to my rules section would ...

JQuery Validator Plugin

I have managed to implement the validator on a form, and is working fine for all my needs apart from a crucial last one. Does anyone know how I would go about (or whether it s even possible) to ...

JQuery validation plugin - error highlight problem

I have a form with two input textboxes, and I have included jQuery validation rules for both: <script src="../../Scripts/jquery-validate/jquery.validate.js" type="text/javascript"></script&...

热门标签