[development] Searching for AHAH! instead of AHAH?

Randy Fay randy at randyfay.com
Thu Dec 30 06:10:37 UTC 2010


I won't have a chance to look at this tonight, but just a comment that is
probably irrelevant:

It's highly unusual to set #tree on a portion of a form rather than the
whole form. #tree makes $form_state['values'] have its values in a
hierarchical, rather than flat, arrangement, and it's not clear why you
would want that. It's also rather dangerous to mess with #tree when you're
form-altering, as it changes what will happen for other participants in the
form.

One thing you should make sure to check: Is ahah.js being loaded on the
page? Just check with firebug. If it's not, you may have to load it
explicitly.

-Randy

On Wed, Dec 29, 2010 at 11:03 PM, <jeff at ayendesigns.com> wrote:

> Next issue. My callback isn't being hit when I change the value in the
> master dropdown. I have the code below...simplified, albeit apparently
> wrong. Unlike the examples, the #ahah being added to the field does not
> result in any ahah references in jQuery.extend(Drupal.settings.
>
>
> function test_menu() {
>    $items = array();
>    $items['test/dropdown/callback'] = array(
>        'page callback' => 'test_do_callback',
>        'type' => MENU_CALLBACK,
>        'access_callback' => TRUE,
>      );
>
>    return $items;
>
> }
>
> function test_form_alter(&$form, &$form_state, $form_id) {
>    if ($form_id == 'test_profile_node_form') {
>        $form['field_two']['#prefix'] = '<div id="field-two-wrapper">';
>        $form['field_two']['#suffix'] = '</div>';
>
>        $form['field_master']['#ahah'] = array(
>            'path' => 'test/dropdown/callback',
>            'wrapper' => 'field-two-wrapper'
>        );
>        $form['field_master']['#tree'] = TRUE;
>    }
> }
>
>
> function test_do_callback() {
>
> // do stuff here
>
> }
>
>


-- 
Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20101229/adb6bd0e/attachment-0001.html 


More information about the development mailing list