I'm trying to make a ahah form. the problem is the ahah is ignored. when i check the classes on the submit button, it doesn't have the 'ahah-processed' class. The really interesting thing is that ahah is working perfectly on my site, and even on a nearly identical form I created. this is how i'm creating the ahah submit button:

$form['ri_email_submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
        '#weight' => 1,
        '#submit' => array('ri_email_form_submit'),//none JS version
        '#ahah' => array(
          'event' => 'click',
          'path' => 'ri_email/ajax',
          'wrapper' => 'email-friend-wrap',
          'method' => 'replace',
          'effect' => 'fade',
          'progress' => array(
            'type' => 'bar',
            'message' => t('Loading...')

I checked the menu path, it's correct.

UPDATE: this is the menu callback:

function ri_email_ajax() {
    return drupal_json(array('status' => TRUE, 'data' => '<p><strong>Your email has been sent.</strong><p>'));   }

by the way, i discovered that it didn't work when i invoked drupal_get_form() from page.tpl.php, but it does work from node.tpl.php

there is something missing with the javascript that is supposed to handle the ahah

  • I second your request Chapabu.
    – cayerdis
    Dec 7, 2012 at 20:14

1 Answer 1


Can you post the callback function generating the page at 'ri_email/ajax'?

It should look something like this:

  function awesome_ahah_callback() {
    $thing_to_process = $_POST['thingfromform']
    /* do stuff, including generating some kind of $processed_data variable */

      'status' => TRUE, 
      'data' => $processed_data,

If you aren't generating the thing you want to send back through AHAH with drupal_json and then calling exit() then I don't think it will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.