I have a module which triggers AHAH events based on a checkbox or select state change. The module works fine on FF, Safari and Chrome but on IE (6 and 7) I get the error:
Error: Object doesn't support this property or method
Code: 0

You can see for yourself if you like:
http://meet-the-newmans.org/php/?q=imgtax/page

(change the source image gallery or check a box). I have looked at the HTML this generates and I don't see any glaring issues with the response, looks like a normal JSON response. So it must be some issue specific to the IE JS implementation.

I have a simple test module (http://drupal.org/node/308310) which does work in IE, so AHAH does work on IE to some extent.

How do I even approach this problem? IE gives no clue which object/method it chokes on.

Comments

pre911mindset’s picture

Here is a sample module that creates the problem. Issue created against Drupal core.

<?php
// Minimal AHAH Form Implementation for 6.x
// Place these 2 files into /sites/all/modules/test
// test.module - this file.
/* test.info - should contain this:
name = "Test"
description = "For Testing."
core = "6.x"
version = "6.x-1.1"
 * * * */

define(TEST_WRAPPER,'ahah-will-replace-this-stuff');
define(TEST_PATH,'test/ahah');
define(TEST_TEXT_FORM_FIELD,'Test-Text-Body');

/** Implementation of menu_hook.  **/
function test_menu() {
  $items['test'] = array(
    'title' => 'Test setup',
    'description' => 'A simple test form.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array ('test_cb'),
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM
  );

  /**
   * This is the path in your site to the ajax/ahah callback function.
   */
  $items[TEST_PATH] = array(
    'title' => 'Test setup',
    'description' => 'A simple test AHAH callback.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array (
           // first argument is the callback function.
            'test_ahah_cb'),
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM
  );

  return $items;
}

/**
 * Here is our menu callback function (see menu_hook).
 * Just create a simple form with a single button.
 * @return drupal form array
 */
function test_cb(&$form_state) {
    $form['test'] = array (
    '#prefix' => '<div id="'.TEST_WRAPPER.'">',
    '#suffix' => '</div>',
    '#type' => 'fieldset',
    '#title' => 'Test Module...', 
    '#tree' => TRUE,
    );

    $form['test']['button'] = array (
    '#type' => 'checkbox',
    '#name' => 'Test Submit Button',
    '#title' => 'Push Me',
    '#id' => 'unique-test-id',
    '#ahah' => array(
        'path' => TEST_PATH,'event' => 'click','wrapper' => TEST_WRAPPER,
        'progress' => array('type' => 'bar', 'message' => t('Grinding...')),
      ),    
    );
    $form['test']['action'] = array (
        '#type' => 'select',
        '#name' => 'action',
        '#title' => t('Action To Perform'), 
        '#options' => array('one'=>'1','two'=>'2'),
         '#default_value' => '1',
        '#description' => 
     t('A select as second element'),
);
    return $form;
}

/**
 * This is the callback function for the ajax part.  
 * Return the original form, with some updated stuff on 
 * it.
 */
function test_ahah_cb() {
    
    // Unlike with normal 'submit' cb, $form and $form_state don't come
    // with ahah callbacks.  We need to get them from the cache.
    $form_state = array();
    $form_build_id = $_POST['form_build_id'];
    $form = form_get_cache($form_build_id, $form_state);
    
    // Now, set the fields in the old form the way we want them.
    // For this example we are adding a new field.
    $form['test']['body'] = array(
      '#type' => 'textfield',
      '#name' => TEST_TEXT_FORM_FIELD,
      '#default_value' => t('You\'re Welcome'),
      '#size' => 40,
      '#maxlength' => 40,
      );        
    // If this is ahah cb, $_POST php global contains
    // info about the form that was posted.
    $value = 'Thank You';
    if (isset($_POST[TEST_TEXT_FORM_FIELD])) {
        $value = $_POST[TEST_TEXT_FORM_FIELD]; 
    }

    $form['test']['button']['#title']= $value;
      
    $form['test']['check']['#default_value'] = $debug;
   
    // Now we need to save the form in the cache, so that future
    // submits will work with it.  Note that we could set stuff
    // in form_state['storage'] if we wanted to.
    form_set_cache($form_build_id, $form, $form_state);
    
    // Rebuild the form and display.
    $form = form_builder($_POST['form_id'], $form, $form_state);
    $output = drupal_render($form);     
    print drupal_to_js(array('data' => $output, 'status' => true));
    exit();         
}

?>
SasikalaVijay’s picture

I have browsed your site http://meet-the-newmans.org/php/?q=imgtax/page in IE7

I didn't get any object doesn't exists error.

When i run your sample, i can get the error.

Could you share, how to solve this issue

SasikalaVijay’s picture

I got the solution in http://drupal.org/node/321421