0plus1
0plus1

Reputation: 4555

ie8 submit->onclick return true doesn't work

I have a problem on ie8.

Im using jquery validate like this:

$(document).ready(function(){
    $("#form_utente").validate({

       rules: {
........

Then, as I usually do I also check like this:

function isValid(){
    var valid = $("#form_utente").valid();
    return valid;
}
<input value="<?=_('Invia');?>" type="submit" onclick="return isValid();" />

This works perfectly on all browser (including ie7) bot don't work on ie8, somebody knows why?

Thank you very much for your help

EDIT:

FULL JS CODE

function isValid(){
    var valid = $("#form_utente").valid();
    return valid;
}
$(document).ready(function(){
    $("#form_utente").validate({

       rules: {
            'data[email]': {required:true, remote:base_url+"store/ajax_check", email:true},
            'data[password]': {required:true, minlength:6},
            'data[password2]': {required:true, equalTo:"#password"},
            'data[nome]': {required:true},
            'data[cognome]': {required:true},
            'data[indirizzo]': {required:true},
            'data[comune]': {required:true},
            'data[provincia]': {required:true},
            'data[cap]': {required:true,digits:true,maxlength:5},
            'data[nazione]': {required:true},
            'data[telefono]': {required:true,digits:true}
       },
       messages: {
            'data[email]': {email:"Inserire una email valida.", remote:"Email gi&agrave; registrata"},
            'data[password]': {minlength:"La password deve essere pi&ugrave; lunga di 6 caratteri."},
            'data[password2]': {equalTo:"Le password non coincidono"},
            'data[nome]': {},
            'data[cognome]': {},
            'data[indirizzo]': {},
            'data[comune]': {},
            'data[provincia]': {},
            'data[cap]': {digits:"Pregasi inserire un cap valido", maxlength:"Pregasi inserire un cap valido"},
            'data[nazione]': {},        
            'data[telefono]': {digits:"Pregasi inserire un numero di telefono valido",maxlength:"Pregasi inserire un numero di telefono valido"}
        },
        success: function(label) { 
            label.html(" ").addClass("checked"); 
        } 

    });
});

Upvotes: 0

Views: 1233

Answers (2)

Neha
Neha

Reputation: 190

@0plus1 : I think you are checking your code in IE8 Emulator by using F12 (not in true IE8 Browser). There is some issue in jquery.validator.js as it make all input field present in the form as required field in IE8 emulator. But in true IE8 is works fine.

Upvotes: 1

xkeshav
xkeshav

Reputation: 54016

PLEASE read the manual of valid

validate() needs to be called on the form before checking it using this method

this link may help u

Upvotes: 0

Related Questions