[development] Using AHAH to load a default set of fields and values

Jeff Hartman lists at jeffhartman.com
Wed Jan 19 21:44:33 UTC 2011

On Jan 18, 2011, at 7:41 PM, Andrew Berry wrote:

> On 2011-01-18, at 6:43 PM, Jeff Hartman wrote:
>> I have a particular content type where I have a vocabulary/taxonomy drop down. I am using hook_form_alter to modify this menu to use ahah in order to query the db for a bunch of default values to populate other portions of the form.
> #default_value is the way to go. My guess is that the ordering of your module is causing another module to set #default_value after yours does. Dropping the weight of your module will likely fix the issue.
> I've been working on AHAH forms as well, and ended up writing this helper function to set default values. Call it at the end of your form callback and it will populate default values based on the current state of the form.

Didn't seem to work for me. But I did determine that #default_values are not populating when the field type is a textfield. It works fine on all other field types.

I inherited most of the code for this site and I wonder if there is some function that is giving problems for the CCK textfield.

My next step is to load this in a fresh Drupal install and see if it exists there as well.

More information about the development mailing list