Grayside.Org

Home

prepopulate

Overriding Prepopulate: Do Not Use hook_form_FORM_ID_alter

grayside — Fri, 02/12/2010 - 11:31

The Prepopulate module works some great magic to preload forms from URL variables. But suppose you need some extra magic to modify the titles it puts in place?

You can always use hook_form_alter (and here is one of countless little tutorials on that).

If you already know about that, you might be someone that enjoys the use of hook_form_FORM_ID_alter(). If you do, you cannot use it to override Prepopulate-set fields. It turns out that regardless of module weight, hook_form_FORM_ID_alter is called before hook_form_alter for any given form, meaning that the more specific function will always set the value, then Prepopulate will come along and reset it to your URL value.

There is a nice issue (#300481) that details this problem, and hopefully will find itself fixed in Drupal 8.

  • drupal
  • drupal6
  • drupal8
  • hook_form_alter
  • prepopulate
  • Add new comment
  • Read more

Prepopulating Casetracker

grayside — Tue, 11/03/2009 - 11:32

The Prepopulate module for Drupal is a nifty little tool that resets the default values of forms on their way to the browser. This is particularly useful for crafting links to create nodes with pre-set values. You can even prepopulate Case Tracker form values to help users create cases filled out as you would like.

  • casetracker
  • drupal
  • prepopulate
  • Read more
Syndicate content

Monthly archive

  • March 2010 (4)
  • February 2010 (2)
  • November 2009 (7)
  • October 2009 (1)
  • September 2009 (5)
  • August 2009 (1)
  • July 2009 (1)

Feeds

Syndicate contentHeadlines

casetracker cck drupal fields FL3 freelinking how-to module node-form openatrium permissions plugin
<all>

© 2009 grayside.org ♠ Glossary ♠ Powered by Drupal ♠ Floating on Archlinux