Adding a simple magento password strength meter in form

Magento Password strength meter brings user interaction with forms. Magento provides built in support for form validation. However if it provides a nice Interactive validation response it would increase the user experience. Lets say while creating a password it would be nice if the user gets to know about the strength of his password.

So we write a simple javascript function to achieve this functionality in the customer registration form.

Step 1: First we add the required UI Elements under the password Field. A Few div tags to show the password strength messages as shown below


Step 2: Now We need to Write the actual javascript function. Since magento uses the prototype javascript
library we follow the prototype style code implementation.

Step 3: Our Custom Javascript code will be implemented under the form tag. First we need to handle the Events. Whenever a User enters some value in the password field our function should get executed.


Step 4: The above code snippet gives hints about the strength of the password he entered. if the password contains less than 6 characters it would indicate the password strength as Weak, if the password is more than 6 characters and also have lower case and uppercase characters with numeric digits it is considered as strong password.


Compatability: Magento 1.6

  1. Juan Fach says:

    Hi Ramesh

    Maybe for a better understanding and avoid confusion would be nice to define path and in which files this should be add it. If you consider this articles HOWTO’s, right?

    • Ramesh says:

      Hi Juan, It is not a full fledged module Just a template file modification. There is no specific JS files involved, all you have to do is to add the Javascript
      under the form tag of your customer registration template file. It is specified in Step 3 too. But anyway the post will be updated with syntax highlighter soon.

  2. Rod says:

    useless without at least providing where to put the JS…
    And why do you put the code as picture?
    If you don’t want to share, then don’t share at all!!

    • Ramesh says:

      Hi Rod, Sorry for the inconvenience at the time of writing this post there was some problem with the Syntax Highlighter. To Show the code with clarity i used image screenshot. Now the problem is fixed will soon update for the older post like this.

Leave a Comment

Your email address will not be published. Required fields are marked *