Is there a way to get notified when a select list is changed (and subsequently its new selected value)? The select list is created with CCK, but the module has access to the form and its elements through hook_form_alter()

Comments

Anonymous’s picture

I think you can use #ahah when altering the list. also check http://api.drupal.org/api/file/developer/topics/forms_api_reference.html

jefflane’s picture

How do you add an #ahah property after the form element is already built?

I would think it would be this, but this doesn't work:

function jeff_form_alter(&$form, &$form_state, $form_id)
{
	if ($form_id =='job_node_form') // my CCK form
	{		
		$form['field_department']['#ahah'] = array(		
     		    'event'   => 'change',
      		    'path'    => ahah_helper_path(array('service_info')),
      		    'wrapper' => 'billing-info-wrapper',				// already defined elsewhere
		);    						
	}	
}