Welcome Guest, Not a member yet? Register   Sign In
[solved] don't understand javascript variable scope; now talking about validation plugin
#16

[eluser]SPeed_FANat1c[/eluser]
Just made this code on my test page work:
Code:
$('input.save').click(function() {
        
        $('form').attr( 'target', '' );
      
       valid = $(".edit").validate({        
            submitHandler:function(form) {

            console.log('ok');
//            document.myform.submit(
//            
//                
//                    );
          
            
            
          
               },
            rules: {
                 input_pavadinimas: {
                  required: true,
                  maxlength: 20,
                
                
                    remote: {
                    url: "http://www.ylakiudarzelis.lt/admin_/info_psl/name_check_ajax",
                    type: "post",
                    data: {
                        
                        current_name: function(){
                            return $('input[name="name"]').val()
                        }
                      },
                
                    }    
                }                
            }
        
            
        }
                
        
        ).form();
  
    });


});

It even submits when I uncomment document.myform.submit()

But when I copy paste it in real projenct page, the submit handler is not executed.. Don'k know why. Will have to debug I guess.
Quote:Thing is, I sort of lost track of what you exactly are validating. Are you validating random content (like the length, or wether it’s filled in) or are you checking if the value of a form is a certain value (out of a list of values)?

I am validating menu names. Admin can add add information pages, so also it creates menus. So I need to check if if he does not add the menu with the same name.

Big Grin now just a thought came: why I even use ajax there, there isn't like 10000 menu items, I could just put all menu names in hidden field seperated by ; and check if the admin is not using already taken menu.


Messages In This Thread
[solved] don't understand javascript variable scope; now talking about validation plugin - by El Forum - 01-26-2011, 11:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB