Note: This module is no longer supported. Its functionality is now included in Drupal 6.
#1) Attached to an existing form element. ex:
$subform['new_choice']['add_choice_button'] = array ( '#type' => 'button', '#value' => t( 'Add New Choice' ), '#id' => 'poll_add_choice_button', '#ahah_bindings' => array ( array( 'wrapper' => 'poll_choices_wrapper', 'event' => 'click', 'path' => 'poll/poll_update_js', ), ), );
#2) Attached to a wrapper, to bind to a dynamic set of elements, which do not exist when the page is first rendered. ex:
// establish the choices wrapper $form['choices'] = array ( '#type' => 'fieldset', '#title' => 'Choices', '#prefix' => '', '#suffix' => '', '#ahah_bindings' => array( array ( 'selector' => 'input.poll_choice_remove', 'event' => 'click', 'wrapper' => 'poll_choices_wrapper', 'path' => 'poll/poll_update_js', ), array ( 'selector' => 'select.poll_choice_weight', 'event' => 'change', 'wrapper' => 'poll_choices_wrapper', 'path' => 'poll/poll_update_js', ), ), );
In both cases most of the sub-parameters are the same:
'wrapper' - the area that will be replaced when the event occurs. It is currently assumed that the element is inside this wrapper.
'path' - the Drupal system path to call to get the updated html to put into the wrapper
'class' (optional) - the class of form elements to bind to. If this is missing, the element's id is used.
'params' (optional) - an array of parameters to pass back to the path.
* Currently only works with Clean URL's enabled
This project is supported by CITRIS: The Center for Information Technology Research in the Interest of Society, located at UC Berkeley