Hi. I'm trying to deploy a form with dependent autocomplete fields in
Drupal 6.

The second dependent field is a Drupal node reference field which has
its own callback function specified by a native module. Once the user
has made their first selection, I need to prevent that callback from
happening and execute the custom URI based on a new parameter.

When drupal attaches the autocomplete behavior it checks to see if the
behavior is already set via the autocomplete-processed class so I've
tried unbinding the original handler as well as removing the class
before reattaching the autocomplete behavior.

However, in the following code, the parameter (company) is set but the
new URI is not. Can anyone tell me what's wrong with the URI
assignment and also if the unbind and removeClass is the right way to
override the original handler?

$(document).ready(function() {

          $("#edit-field-ticket-company-0-nid-nid").blur(function() {
        companyvalue = $("#edit-field-ticket-company-0-nid-
nid").attr("value");
        re = /\[nid:(.*)\]/;
        resarray = re.exec(companyvalue);
        if (resarray) company = resarray[1];

        //This line below is wrong ???
         $("#edit-field-ticket-contact-0-nid-nid").value ="http://
localhost:8888/drupal64/intranet/ticket/contact/autocomplete/" +
company;
         $("#edit-field-ticket-contact-0-nid-nid").unbind('keydown');
          $("#edit-field-ticket-contact-0-nid-nid").unbind('keyup');
          $("#edit-field-ticket-contact-0-nid-nid").unbind('blur');
          $("#edit-field-ticket-contact-0-nid-nid").removeClass('autocomplete-
processed');
         Drupal.attachBehaviors(document);

     })
   })


Reply via email to