0  0 2015-03-26 02:11:37

Best Option, Use Field Validation

Validation at client side is the basic expectation from any Web Form.

We all know that technology is used to save the user time as well as to increase the feasibility of interaction with web application, in this scenario validation plays very important role.

Now days everyone use at least one web application and they are come across information filling with web forms.

Now if user is alerted or informed within the seconds or rather nanoseconds that the information they are entered is not expected as require then people will change within a second and they can move ahead with their expected results. Client side validations are therefore so important in web forms.

In Drupal’s any theme you must come across the plenty of web forms where information is expected to get fulfilled by user.

There are two options we can go for implementing the client side validation:

  1. Write the code for every single textbox at every single page.
  2. Use Field validation Module.

Here we will talk about Filed validation Module.

Here we are targeting to provide

  1. Numeric validation
  2. Text validation and
  3. Phone number validation.

For Validation we added one module/API.

Steps to add that module to our theme,

a. Download the module from given path.

b. Click on Module option present in the admin section.

c. click on the “Install new Module”.

    d. click on the “Browse” button or else you can provide the URL.

    e. Once you click on browse button select the Module which u want to  install. And click on              install.


f. now click on Enable newly added modules.

 g. you will be redirected to module page. Here search for field

        validation module and select the checkbox in front of it.

    h. at the bottom of page click the save button. Your module is now enable for use.

   Now, you can see validate tab for every field inside the manage fields tab.



For individual fields we can provide the validation.

Click on the “validate” of first name field.

 Click on "Regular expression (Perl-Compatible)".


 Here we need to provide all details for validation

Most imp field is Pattern ,

As we are providing validation for name will make sure that only alphabets and minimum 2 charater it should have.

Therefore, regular expression will be::  /^([a-zA-Z ]){2,30}$/


  1.  Click on save rule, validation will be applied.

For LAST Name Same steps applied

Click on the “validate” of Phone Number field.

            For phone number will provide different pattern.

            Expression will be :   /^([0-9]){8,16}$/

Here we done with all the validation.


Comments (0)

Post Your Comments


Hong Kong Office

Find Us On

Website Development Company
Digital Marketing
website development company in Hong Kong
website designer in pune