This is a migrated thread and some comments may be shown as answers.

.validate() not working on IE7

3 Answers 56 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 19 Nov 2013, 01:37 PM
Hi everyone,

We've been trying to use the Kendo Validator component to validate a complex data entry form, and unfortunately for this project we need support for IE7. 

The validation itself works fine on specific fields, and messages pop up as normal when wrong values are entered, however a call to

$("#form").data("kendoValidator").validate()

on form submission fails with the error message "Failed". Since under IE7 there is very little information about what the error is and how to fix it, we've been wondering if anyone knows how to proceed, or if anyone has had similar experiences in the past.

Many thanks!

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 20 Nov 2013, 07:54 AM
Hi Markus,

I'm afraid that provided information is not sufficient in order to trace the cause for such error. Therefore, it will be appreciated if you could provide a sample page in which this issue can be recreated locally.

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Markus
Top achievements
Rank 1
answered on 20 Nov 2013, 10:12 AM
Thanks for your response, Rosen.

I'm attaching a screenshot of the exact "error" that we are getting now. Kendo version is "kendoui_2013.2.918".

I'll try to describe the exact situation we have and hopefully you can advise us about what other information we can provide to help you.

We set up the validator on the form with the following code:

$(form).kendoValidator({
    messages: {
        required: function(input) {
            return input.attr("requiredValidationMessage");
        },
        pattern: function(input) {
            return input.attr("patternValidationMessage");
        }           
    },
    rules: {               
        required: function(input) {
            if(input.attr("required") === null || typeof input.attr("required") === "undefined"){
                return true;   
            }                  
            else if(input.attr("type") === "checkbox"){
                if(input.attr("checked") !== null && typeof input.attr("checked") !== "undefined"){
                    return true;   
                }                                          
                else{
                    kpi.trigger(kpi.event.validator.mandatoryfieldmissing, input);
                    return false;
                }
            }              
            else if(input.val() !== null && input.val() !== ""){
                return true;
            }                  
            else{
                kpi.trigger(kpi.event.validator.mandatoryfieldmissing, input);
                return false;  
            }
             
        },
        pattern: function(input) {
            var pattern = input.attr("pattern");               
            if (typeof pattern === "string") {
                pattern = new RegExp('^(?:' + pattern + ')$');
            }          
            if(input.val()!== null && input.val() !== "" && pattern !== null && typeof pattern !== "undefined" && pattern !== ""){ 
                 
                if(pattern.test(input.val())){
                    return true;               
                } else {
                    kpi.trigger(kpi.event.validator.patternnotmatch, input);
                    return false;
                }
            }                  
            else{
                return true;   
            }
             
        }          
    }       
});

The form itself is just a simple html form with a Kendo tabstrip and various inputs. The data is fetched via ajax and filled in using a Kendo template. Entries are in this form:

<input #if (required) {# required="" requiredvalidationmessage="Field is required" #}# type="text" pattern="\[+-\]?\\d+" patternvalidationmessage="Please specify a valid number" name="#= searchkey #" id="#= searchkey #" class="numeric autofocus" value="#= value #" placeholder="">


The submit button is simply:

$('#saveButton').click(function(e){
    e.preventDefault();
     
    // bad things happen inside this validate call!!
    var valid = $("#dataentryForm").data("kendoValidator").validate();
 
    if (valid) {
        // $.post(...)
    } else {
        // error
    }
}


We've already tried this in IE8 under compatibility mode, though we can't reproduce it there. It works fine in all other browsers we've tested.

If you see anything that stands out as wrong, or if you even have a vague idea about how to debug this in IE7, please let us know. 

Thanks.
0
Rosen
Telerik team
answered on 20 Nov 2013, 11:38 AM
Hi Markus,

Unfortunately, I'm still unable to recreate such issue using the details you have provided. Here is a test page which uses given information. Could you please prepare a runnable test page or modify the one I have provided which the issue to be observed locally.

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Validation
Asked by
Markus
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Markus
Top achievements
Rank 1
Share this question
or