Drupal Tableselect with fields

in drupal, form api, fapi, fields, tableselect

We all know that Drupal provides the FormAPI, in which very powerful form elements exist (in our case, the tableselect element). This magical element behaves like a table, but has a checkbox for each line, and associated JS/CSS to handle checking rows. But it is normally impossible to add additional form elements on each row ( there have been many workarounds, but all seem hackish) due to the way Drupal handles form submission. This is how to have a clean (and simple!) way to go around those restrictions.

Read more »

Dealing with checkboxes quickly

in drupal, fapi, forms, checkboxes

I've been working with the Forms API for some time. I've found a very useful shorthand for that today.

Read more »

Disabling a checkbox with FAPI without the javascript

in drupal, fapi, forms

Forms API is great, let me start there. However there are some cases where you want to ... ahem, go around it. One such cases is with checkboxes (where you have a number of checkboxes), specifically when you want to alter just one of the set. Here's how to fix that!

Read more »

FAPI form_alter missing fields

in drupal, cck, fapi, fields, form_alter

There are many occasions in which you would like to alter a form behavior, and it's normally very easy to do -- just implement hook_form_alter and you're done. There are cases though, where fields will be missing, and in those cases, you need a workaround.

Read more »

Drupal FAPI multistep errors on required fields

in drupal, error, fapi, multistep

One of the great usability features in the Drupal Form API are simple validators, such as #required. Just set it to true, and Drupal takes care of it. However, when in a multistep scenario, simple validators go haywire since moving to a different step validates the form. Normally, you cannot override form errors within your validation hook... but there's a workaround.

Read more »