Magento - difference between validator and validator.validate ()

In login.phtml, what is the difference between validator and validation - can anyone explain what each of the lines below means

function onepageLogin(button)
        {
            if(loginForm.validator && loginForm.validator.validate()){
                button.disabled = true;
                loginForm.submit();
            }
        }

      

Thank.

+3


source to share


1 answer


loginForm.validator

just checks for the existence of the object (continue if it exists) and loginForm.validator.validate()

calls the validate () function of the object (and if the function also returns true, then the commands inside the if statement will be executed).



+2


source







All Articles