سؤال

I am using the below Jquery libraries and JQ script to validate a form. the application containing this form was developed using Struts 1.2 framework with tiles .

 <script src="javascript/jquery-1.10.2.js"></script>
 <script src="javascript/jquery.validate.js"></script>
 <script src="javascript/additional-methods.js"></script>
 $(function() {
     $( "#serviceRtpLogMainForm" ).validate({
         rules: {
             p_incdate_in: "required",
             p_category1_in:"required",
             p_custname_in:{
                            required: function () {
                                         if($(".type1").is(':checked'))
                                         { return false;} 
                                         else
                                         { return true;} 
                                        }
                            },
                            p_subconame_in:{required: '#ext:checked'},
                            p_thirdPartyVendor_in:{required: '#ext:checked'},
                            p_ncBranch_in:{required: '#int:checked'},
                            p_ncDept_in:{required: '#int:checked'},
                            p_vndrtyp:"required",
                            p_cause_in:"required",
                            p_action_in:"required"
                },
         messages: {
             p_incdate_in: "Please enter the incident date.",
            p_category1_in:"Please select a category.",
            p_custname_in:"Please click on 'Show List' to select a customer."
                },
         submitHandler: function(form) {
                    // do other things for a valid form
                    form.submit();
                 },
     });
});

Now the above code runs perfectly in FF and chrome. But in IE, the empty form gets submitted when i click submit.

To troubleshoot, i tried debugging in IE developer tools. But when i try to place a break point on the JQ function, it throws an error message saying "Breakpoint cannot be set at this point.. the code in the document is not loaded"

How should i approach this? Let me know if you need more info.

هل كانت مفيدة؟

المحلول

try to remove comma into the last object like this:

submitHandler: function(form) {
                // do other things for a valid form
                form.submit();
             },

to this:

submitHandler: function(form) {
                // do other things for a valid form
                form.submit();
             }

IE return error if last object has a comma after that

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top