You are hereMonthly archive / February 2010

February 2010


rahul's picture

Drupal - Changing form field values in validation/submit handlers

All Drupal module developers would probably be aware of Drupal Form API's form_set_value() method, which allows you to "change submitted form values during the form processing cycle."

You can use this method in the form validate handler to process a different value in the form submit handler, than what was submitted by the browser. However, remember the new value would be used for processing only, and would not be rendered to the browser if you have not specified a redirect url for the form, and the same form renders again after submission.

rahul's picture

Generating Public/Private key pairs in Drupal

While working on a major enhancement to my open-source Take Control module for Drupal (to be released soon), I needed to generate public/private keys for making secure asynchronous Ajax calls.

A quick Google search revealed that PHP's Open SSL package should do the job. Some reading of Open SSL docs, and a quick overview of my development machine's phpinfo() output revealed I already had Open SSL setup, and enabled on my local Apache web-server.

rahul's picture

System.ArgumentOutOfRangeException at System.Web.HttpCachePolicy.UtcSetLastModified (DateTime utcDate)

Working across timezones can have its own stupid issues. I faced one of them just now.

I finished working on the initial production setup of a client ASP.NET website, and uploaded and installed it to a remote server based in United States (in the Eastern Time zone). I am based in India (with Indian Time Zone), which is 10:30 hours ahead of the server time on which the site was uploaded.

rahul's picture

Navigation between Editable cells of an ExtJs GridPanel

I use ExtJs GridPanel extensively both for displaying tabular information as well as for data entry. Data entry with GridPanel is mostly a pain in the neck due to navigation issues between cells.

You can use Tab/Shift+Tab for moving between adjacent cells. This works fine in ExtJs 3.x, but has issues in ExtJs 2.x and earlier. Moreover, you need to use mouse for moving between rows, and adding new rows.

So, I created a plugin for making such navigation easy. Tab/Arrow keys mostly are handled by the ExtJs framework. This plugin uses Ctrl+Arrow keys for navigation.

rahul's picture

Add Images/Html in Drupal Node Titles

After some frantic hair-pulling, I finally got this to work in Drupal 6.x. Here I am presenting 2 ways to add images/Html to Drupal node titles (both based on template.php), and you can choose any of them as per your needs. There are pretty other options (including doing this via background-images & css).

rahul's picture

Custom JSON Serialization of objects using ExtJs

I thought this should be pretty easy to accomplish, with the extensive feature set that ExtJs provides. What I basically wanted to control was how the objects of my class are serialized by the Ext.util.JSON.encode (Ext.encode) method (I needed this for serialization of enums I discussed in the pevious blog posts, here and here).

rahul's picture

Enums in Javascript - Part 2

I blogged about this topic earlier also here. That blog post presents an approach to create enums (enumerations) in javascript, exactly like those available in .NET or Java.

The later portion of that blog post mentions that the approach presented is extensible, and we can move the parse() and toString() methods to a base class easily. I knew I would myself need to do this some day (create a base javascript class for enums), but never expected it to be this much soon.

rahul's picture

Generating markup for Drop-Down menus in Drupal

I am not presenting the actual approach here. I created this blog entry just to point to this wonderful tutorial in Drupal's official theming guide for this purpose, which describes all the steps in a clear and concise way.

rahul's picture

Thickbox - Show on Page Load

I had a situation where I needed to show a Flash movie in a modal dialog on a Page. Needless to mention, LightBox is the first thing that strikes to mind for such purposes. However, LightBox supports only images. And I needed to show a Flash movie.