How to validate form fields in magento without submitting the form

If you want to validate a form in Magento using prototype validations, if you use

myForm = new VarienForm('myform-id'); myform.submit = function () { results=myForm.prototype.submit.bind(myForm)();

then the form will be submitted automatically if there is no error. That’s perfectly fine unless you want to do other work before submitting, for example submitting the form in an ajax request.

Instead you can do this to test

myForm = new VarienForm('myform-id'); myform.submit = function () { results=myForm.validator.validate();

If results return true then there is no error.

How to extend login session to PhpMyAdmin and prevent time out

As part of my work, I often use PhpMyAdmin, though after I use PhpMyAdmin, I do some work on the script, then I return to PhpMyAdmin to add some SQL, and then I get the session has expired message, and I lose the changes. It is so frustrating. The best thing is to edit the configurations and extend the login cookie session if you have access to the PhpMyAdmin scripts on the server.


Navigate to PhpMyAdmin root directory and find , edit the file, then search in the file for “LoginCookieValidity”, if you found one, change the value after the equal sign to the amount of SECONDS for the session to last. if you didn’t find it, then add the following line after any $cfg line, in a separate blank line:

$cfg[‘LoginCookieValidity’]=60 * 60 * 10;

Obviously 60 seconds , 60 minutes , 10 hours . or you can make the value : 3600 * 10 , or 36000 seconds .

If you have no access to PhpMyAdmin scripts, then you have to live with it unfortunately, but what can you do to avoid losing your current page after leaving it for some minutes, right click on any non-dangerous link (; in PhpMyAdmin page and open it in new page, in that new page, enter your username and password, then return to your current page, sometimes though especially when your current page before expiration is insert page with some data, what you do then is just copy paste the data into your fresh login.