Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Validation doesn't work in IE8

I used a JQuery Validation script for validating an HTML Form. This worked perfectly in Firefox but doesn't work in IE8. I think there is issue with colon(;) or semi-colon(,)... but I am unable to catch it.

jQuery.validator.addMethod("selectNone", function (value, element) {
    if (element.value == "") {
        return false;
    } else return true;
}, "Please select an option.");

$(document).ready(function () {
    $("#formElem").validate({
        rules: {
            Category: { // "required",simple rule, converted to {required:true}
                selectNone: true
            },
            Repair_technician: { // "required",simple rule, converted to         {required:true}
                selectNone: true
            },
            Rework_technician: { // "required",simple rule, converted to     {required:true}
                selectNone: true
            },
            Approved_by: { // "required",simple rule, converted to {required:true}
                required: true,
            },
            Part_code: {
                required: true,
            },
            Part_value: {
                required: true,
            },
            JOB_Number: { // "required",simple rule, converted to {required:true}
                required: true,
                minlength: 9,
                maxlength: 9
            }
        }
    });
});
like image 597
user437641 Avatar asked Sep 15 '10 22:09

user437641


1 Answers

These two:

        Part_code: {
            required: true,
        },
        Part_value: {
            required: true,
        },

Should be:

        Part_code: {
            required: true
        },
        Part_value: {
            required: true
        },

You're right to think the , issue, a trailing comma in a property list is what'll break IE but usually squeak by in other browsers.

like image 120
Nick Craver Avatar answered Nov 14 '22 23:11

Nick Craver