Core 6.16

I have a function, in a custom module, that binds ahah links like so:

    public function bind_ahah_link( $url, $selector, $wrapper, $link, $effect, $title = false ){
      $ahah_binding = array(
        'url'   => url($url),
        'event' => 'click',
        'wrapper' => $wrapper,
        'selector' => '#'.$selector,
        'effect'   => $effect,
        'method'   => 'replace',
        'progress' => array('type' => 'throbber')
      );
      drupal_add_js('misc/ahah.js');
      drupal_add_js('misc/jquery.form.js');
      drupal_add_js(array('ahah' => array($selector => $ahah_binding)), 'setting');
      $render = l( $link, '#', array ( 'attributes' => array( id => $selector, 'title' => $title ) ) );
      return $render;
    }

This works great for me -- until I install jQuery Update. At that point the binding simply stop functioning.

Firebug reports no js errors and all the required js files are included. I have disabled every other jQuery module and the issue persists.

When I disable jQuery Update, my bindings function again -- BUT if I call the updated jquery.form.js directly (rather than letting the module do it) like so:


      drupal_add_js('misc/ahah.js');
   //   drupal_add_js('misc/jquery.form.js');
   //   drupal_add_js('sites/all/modules/jquery_update/replace/ahah.js');
      drupal_add_js('sites/all/modules/jquery_update/replace/jquery.form.js');

... I'm back to the same problem...

Any thoughts? Is this a silly way to bind my links anyway?

Comments

oc666’s picture

confirm this bug. jquery_update-6.x-2.x-dev break ahah and simple uses are not implement at all. Example of one that doesn't work (from form api):
$form['choice_wrapper']['poll_more'] = array(
'#type' => 'submit',
'#value' => t('More choices'),
'#description' => t("If the amount of boxes above isn't enough, click here to add more choices."),
'#weight' => 1,
'#submit' => array('poll_more_choices_submit'), // If no javascript action.
'#ahah' => array(
'path' => 'poll/js',
'wrapper' => 'poll-choices',
'method' => 'replace',
'effect' => 'fade',
),

Sylvain Lecoy’s picture

I confirm as well. Here is a ahah link which does not work with jquery_update-6.x-2.0-aplha1:

<?php
$report_link = array(
  '#value'  => l( '( <span>' . t('Report') . '</span> )', "report/$node->nid", $options ),
  // id for ahah formatter.
  '#id'     => 'report-link',
  '#ahah'   => array(
    'event'   => 'click',
    'path'    => "report_js/$node->nid",
    'wrapper' => 'report-overlay',
    'effect'  => 'fade',
  ),
);
$variables['report'] = drupal_render(form_expand_ahah($report_link));
?>
Sylvain Lecoy’s picture

I think if someone is about to fixe this, he should have a look at how quicktabs implemented the ahah and form fixing.

http://drupal.org/project/quicktabs

Equinger’s picture

subscribe.

Equinger’s picture

I can confirm that commenting that file out in the module is necessary AND sufficient to solving this ahah problem.

Equinger’s picture

I also can confirm that the very latest version of this jquery forms plugin here: http://jquery.malsup.com/form/#download does not work either

smoothify’s picture

Not sure if its an exact duplicate, but this issue is very similar, and contains a fix.

#806500: jQuery update breaks AHAH form when there is a file input (file upload) in the form

kiploona’s picture

Confirm.

Excluding 'jquery.form.js' solves a problem.

BTW, in safari .js console i found an error, when tried to change AHAH dropdown element:
TypeError: Result of expression '(jQuery(this).data('form-plugin-onload'))' [undefined] is not a function.

Firefox keep it silent. So, maybe, this info will help developers to solve tis bug...

NiklasBr’s picture

I don't know if there is any use commenting on this old issue, but I just want to say that I hit upon it today with Drupal 6.28.

markhalliwell’s picture

Status: Active » Closed (outdated)

Drupal 6 reached EOL (end-of-life) on February 24, 2016.