0

Hello,

I have problem with submiting form in IE. This is the part of the code for submission. I am using jQuery validate and form plugins. On other browsers it submits. Tried ie7, ie8, ie9 and none of them submitted. (actually I tried on IE9, but in ie7, ie8 modes.) And they don't give me any error message.

$("#register_form").validate({
           errorClass: "reg_error",  
           rules: rulesStep1,
           messages: messages,
           //onsubmit: false, //nevercia validatint formos submitinant
           submitHandler: function(form) {
               console.log('submitinsim su ajax'); //IE7 sito neuzlogina
               //$("#register_form").ajaxSubmit();
               //$("#register_form").ajaxSubmit({
                   
                $(form).ajaxSubmit({
                  // $(this).ajaxSubmit({
                   
                   success: function(data) {
                       if (data == '<head></head><body>registration_successful</body>') {
                           //neaisku kodel su tokiais tagais ateina, bet dideles problemos kaip ir nera
                           window.location.replace(project_url + current_language + 'authentication/sign-up.html');
                       } else {
                           //alert(data);
                           
                       }
                       //console.log(data);
                   }//,
                   //target: "#html" //test
               });
           }
        });

Have you an idea why is that?

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by McLaren
0

this is rulesSpep1 code. But the validation rules are changing depending on in which step the user is.

rulesStep1 = {
             
             //vardas: "required",
             vardas: "required",
             
             username: {
                 required: true,
                 
                 remote: {
                    url: project_url + current_language + "authentication/validate-username",
                    type: "post",
                    data: {                       
                      ci_csrf_token: $('input[name=ci_csrf_token]').val()   //TODO: kazka sugalvoti, kad sito nereiketu kartoti kiekviena karta siuncian per POST
                    }
                 }
             },
             password: {
                 required: true,
                 minlength: 4
             },
             passwordConfirm: {
                 passwordsMatch: true
             },
             // compound rule
             //vartotojoTelefonas: {
             telefonai: {   //neprasom ivesti atkirai varotojo ir imones telefono, jei registrtuojasi imones adminas
               required: true,
               remote: {
                    url: project_url + current_language + "authentication/validate-user-phone",
                    type: "post",
                    data: {                       
                      ci_csrf_token: $('input[name=ci_csrf_token]').val()   //TODO: kazka sugalvoti, kad sito nereiketu kartoti kiekviena karta siuncian per POST
                    }
               }
             },
             elpastas: {        //vartotojo        
               required: true,
               email: true,
               remote: {
                    url: project_url + current_language + "authentication/validate-user-email",
                    type: "post",
                    data: {
                      ci_csrf_token: $('input[name=ci_csrf_token]').val()   //TODO: kazka sugalvoti, kad sito nereiketu kartoti kiekviena karta siuncian per POST
                    }
               }
             }
       }; //end rulesStep1

Example of changing rules:

$("input[name=cmr_file]").rules("add", {
            required: true,
            accept: "bmp|gif|jpg|png|tif|jpeg|pdf|doc|docx"
        });
0

I'm not sure it will make a difference but you could try changing :

//statements of the form
$('input[name=ci_csrf_token]')
//to
$("input[name='ci_csrf_token']")

Airshow

0

Thanks for responses, I have solved this issue. Here is my code (litle lebit unclean but maybe will help somebody one day).

$("#registracijos_mygtukas").click(function(e) {
        
        
        valid = $("#register_form").valid();
        
        
        if (valid) {
            //alert('valid');
            //$("#register_form").submit();
            $("#register_form").ajaxSubmit({
                //    form.ajaxSubmit({
                  // $(this).ajaxSubmit({
                   data: { ci_csrf_token: $('input[name=ci_csrf_token]').val() },
                   
                   success: function(data) {
                       //data = data.toLowerCase();   //ant ie8 ir 7 tagus grazina is didziuju raidziu
                       //if (data === '<head></head><body>registration_successful</body>') {
                       //if (data.toLowerCase() == '<head></head><body>registration_successful</body>') {
                        console.log(data);
                        
                       
                       //if (data.search('/registration_successful/i') != -1) {
                       if (data.search(new RegExp("registration_successful", "i")) != -1) {
                           //neaisku kodel su tokiais tagais ateina, bet dideles problemos kaip ir nera
                           [removed].replace(project_url + current_language + 'authentication/sign-up.html');
                       } else {
                           alert(data.toLowerCase());   
                       }
                       //console.log(data);
                   }//,
                   //target: "#html" //test
               });
        } else {
            //alert('not valid');
        }
        
        
        
        //console.log(valid); //objektas cia
       
       /*
        $("#register_form").submit(function() {
            $(this).ajaxSubmit();  
            return false;   //nesuveike, bande narsykle numest i nuoroda
        }); 
        
        */
       // $("#register_form").submit();
        
        //$("#register_form").ajaxSubmit(); //bandom cia nes IE nenori submititn
        
        //alert('test');
        //console.log('submitinom');
        //log('submitinom');
        //$('fieldset').show(); //kai pazejau visus fielsetus, klaidu nerode
        
        
        
        //alert('submitinom');    //sitas suveikia, bet forma nesubmitinama
    
           //e.preventDefault();    //jei sita naudojam, tai ivykdo sita IE ir sustoja, nebeina i validate
       
        //$("#register_form").validate(); //bandom priverst ji eit i validate funkcija       
       
        return false;
        
    });
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.