Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - Difference between validator and validator.validate()

In the login.phtml, what is the difference between validator and validate - Could someone explain what is the meaning of each of the lines below

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

Thanks.

like image 250
Vinu D Avatar asked Aug 01 '26 03:08

Vinu D


1 Answers

loginForm.validator just checks the existence of the object (go on if it exists) and loginForm.validator.validate() calls the function validate() of the object (and if the function returns true, too, then the commands inside the if-clause will be executed).

like image 124
hellcode Avatar answered Aug 02 '26 18:08

hellcode