AAC not working with radio buttons

mim81 - January 7, 2009 - 14:54
Project:Ubercart Ajax Attribute Calculations
Version:5.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hello,

I need to use aac with radio buttons, but it doesn't work.
I'm using Drupal 5.12 + Ubercart 5.x-1.6 + AAC 1.5 (downloaded from drupal.org).
It doesn't work with IE, Firefox 3 and Safari (under Windows). However, due to FF form status caching, when I select a radio button and reload the page, the correct price is calculated after the page is fully loaded (and the radio button still selected).

Thanks

#1

cYu - January 7, 2009 - 15:02
Status:active» postponed (maintainer needs more info)

Do you have Jquery update installed? I believe UC_AAC 1.5 requires it, but grabbing the latest dev snapshot gets rid of that requirement (which I didn't realize existed at the time I made the release).

#2

mim81 - January 7, 2009 - 16:02

Yes, I installed that. Meanwhile I discovered that the function perform_ajax_calculation_XYZ() is not called on radiobutton onclick event. If I call it manually from the address bar, everything gets set.

#3

cYu - January 7, 2009 - 16:14

Does it work with select box attributes but not radio button? If neither are working, you should check to make sure your template has a div surrounding the node in the format noted on the project page.

#4

mim81 - January 7, 2009 - 16:23

Yes, it works with select boxes but not with radio buttons

#5

cYu - January 7, 2009 - 16:51

mim81: Can you tell why

$("#node-'. $nid .' :radio").each(function () {
  var element = this;
  if (element.name && element.name.match("attributes")) {
    $(this).unbind("click.uc_aac");
    $(this).bind("click.uc_aac", function () {
      perform_ajax_calculation_'. $nid .'();
    });
  }
});

is not binding to onclick of your radio buttons in the initialize_fields_$nid() function? It should find any radio buttons within node-$nid div (which must exist if your select attributes are working), and append to any radio buttons with "attributes" in their name. Are you getting any JS errors?

#6

mim81 - January 7, 2009 - 17:40

I don't know why it's not binding, but I found that it is working with the following modification:

          $(this).unbind("click");
          $(this).bind("click", function () {
            perform_ajax_calculation_237();
          });

#7

cYu - January 7, 2009 - 18:05

mim81: That is the change that is put in place in the dev version which removes namespaced binding. What version of Jquery update do you have running and have you placed all of the .js files into the /misc folder? If you have, then the original code should have worked.

#8

mim81 - January 7, 2009 - 18:29

My mistake, I should have double checked: I had installed JQuery 1.0 instead of 2.0. I upgraded and it worked.
Thanks and sorry for losing your time!

#9

cYu - January 7, 2009 - 19:02
Status:postponed (maintainer needs more info)» closed

No prob, that is useful information...I was unaware that it did not work with the 1.0 branch. I'll add it to the project page.

 
 

Drupal is a registered trademark of Dries Buytaert.