.validate() not working on IE7

4 posts, 0 answers
  1. Markus
    Markus avatar
    10 posts
    Member since:
    May 2012

    Posted 19 Nov 2013 Link to this post

    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!
  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 20 Nov 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Markus
    Markus avatar
    10 posts
    Member since:
    May 2012

    Posted 20 Nov 2013 Link to this post

    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.
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 20 Nov 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready