Abbas is a software engineer by profession and a passionate coder who lives every moment to the fullest. He loves open source projects and WordPress. When not chilling around with friends he's occupied with one of the following open source projects he's built: Choomantar, The Browser Counter WordPress plugin, and Google Buzz From Admin.

Abbas's articles

  1. Building a Multi-Page Wizard-like Form in Drupal

    Drupal gives you the APIs to build forms directly by specifying the details of the form. It will create the underlying html for the form provided you just specify the fields you want in it. We discussed the details of building a form in Drupal a previous article.

    Usally, we would just need a simple form with a few fields, but there may be cases where there might be too many fields on a single page and the form might look confusing and tedious to fill out. This might not make the best UI for your site and it would be good to break your form into logical sections so that it is easier for the user to fill in the information. One way to break the form into different logical blocks is using the field set, but this usually only works if you have a low number of sections. The other way to organize your form is to make it into a wizard or a multi-page form where the user fills the details on one page and then moves ahead to the next page. In this article we will take a look at how to create a multi-page form in Drupal.

    Creating the multipage form module

    The first thing we will have to do is create a module in Drupal. To do this, create a folder sites\all\modules\multipageform in your Drupal installation and add the following files to it

    multipageform.info

    name = multipageform
    description = This module creates a multipage form form using Drupal.
    core = 7.x

    multipageform.module

    <?php
    /**
     * @file
     * This is the main module file.
     */
    
     /**
     * Implements hook_help().
     */
    function multipageform_help($path, $arg) {
    
      if ($path == 'admin/help#multipageform') {
        $output = '<h3>' . t('About') . '</h3>';
        $output .= '<p>' . t('The multipageform module shows how to create a multiple page form using Drupal.') . '</p>';
        return $output;
      }
    }

    Once you have done this you should be able to see the new module in the module list.You can now enable the module.

    Defining the number of pages in the form and the form contents.

    Once we have our module ready, let’s start defining the Multipage form. To do that, the first thing we will do is create a menu item which will display our form. We will have to add the hook menu in our module as follows

  2. Understanding Drupal’s EntityFieldQuery

    When building complex web apps, you’ll eventually have to interact with a database. To retrieve data in Drupal one can use the database abstraction layer provided, which requires some SQL knowledge to be used properly. From Drupal 7 EntityFieldQuery API is provided, which lets you fetch information about entities from Drupal without actually building SQL queries. In this article, let’s see how we can use the EntityFieldQuery API to fetch data from Drupal and use it in our modules.

  3. Understanding Forms in Drupal

    Web applications today are being used in all kinds of industries. They need to take in and process a lot of user data. The capturing of the data happens through HTML forms which let you create different types of input fields like textboxes, radio buttons etc. using HTML tags. These forms get difficult to maintain […]

  4. Building a Drupal 7 Module: Show Latest Nodes

    Drupal is one of the most popular open source content management systems. It has a lot of functionality built in and thousands of free and paid modules to choose from for your site. It has a very extensible and flexible architecture which lets you build on top of the Drupal core and extend its functionality […]

  5. Build Menus in Android with Java and XML: Contextual and Popup Menus

    This entry is part 2 of 2 in the series Build Menus in Android with Java and XML

    This entry is part 2 of 2 in the series Build Menus in Android with Java and XMLIn the previous article in this series, we learned how to create standard options menus for your Android app using XML or built directly through Java programming. Besides these typical options menus, Android developers can also create specialized […]

  6. Understanding the Life Cycle of Activities in Android

    An “activity” in Android is a single screen in which the user will interact. If you want to create a form to take input from the user, or if you need to display information or feedback to the user, you would usually build an activity for the purpose. In some circumstances, an activity will be […]