1

I am building a case tracker on top of Open Atrium. My case node has some custom fields, and the "Case" category is a hierarchical select taxonomy field. I have another field called level which is dynamic and expected to change when the value of hierarchical select field input changes with custom JavaScript.
It works fine, but when the hierarchical select makes an AJAX update of the node form, the custom Javascript code stops working. I checked the Firefox JS error console, and Drupal recent log, but I could not find any error. For some reasons the hierarchical select doesn't work well with my custom JavaScript code.

Do you have any suggestion on how to fix this problem?

  • Hello user1293, and welcome on Drupal Answers. To which Drupal version are you interested? – kiamlaluno May 16 '11 at 18:28
  • He is probably using d6 as Open Atrium is not yet available for D7 :-) – Sivaji May 19 '11 at 6:59
1

Are you using the live() function in jQuery to bind your behaviors? Drupal behaviors are triggered on page load and after every ajax request. If your behavior only needs to be called once then you can use the add class processed trick. It is explained here.

  • Yes, i am using Drupal.behaviors. When hierarchical select module update taxonomy field with ajax request, my custom script is added infinite number of times. – user1293 May 17 '11 at 13:13
  • @user1293 Did you read the second link I posted in its entirety? It solves the problem of appending a button, for example, and every time Drupal is called another button is added because the script is run again. When the script is run it adds a class '.processed' to the element so every time Drupal returns something it can check if it has that class. If that class exists then it skips over it in the script leaving it alone. – Adam S May 17 '11 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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