1 Reply Latest reply on Jun 9, 2007 10:36 AM by BLXWebMaster

    two comboBoxes

    Level 7
      Hi All,
      I have to comboBoxes, one with my customers name and the second with the
      contacts. But I want the contacts automatic update when I change a customer
      Any sample or link ?
      Please advice.... thanks


        • 1. Re: two comboBoxes
          I am assuming that your contact are an ArrayCollection. If so, you can accomplish it by using a filterFunction..

          It would be easier if you posted your code, however you should be able to figure it out.

          Here is a snippet.
          Basically you have an onChange event "arContacts.refresh(); on your Customer cobo box. This will force the filterFunction to check what you selected and filter the contacts based on the CustomerName field which should be in your array for the contacts.

          Also, I suggest adding collection change listener on the arContacts. This way you can also reset the contact combo box to the first index. If you do not, it tends to keep highlghted the previous selected item even though it is no longer in the filtered array.

          private var arContacts:ArrayCollection = null;
          private function getLookupCCReceived(event:ResultEvent):void {
          arContacts= new ArrayCollection();
          arContacts = event.result as ArrayCollection;

          // Filter function
          public function processCCFilter(item:Object):Boolean {
          var result:Boolean=false;
          if ((cbCustomer.selectedLabel == 'Select Customer Name' || (item.Type != null && item.Customer.toUpperCase().indexOf(cbCustomer.selectedLabel.toUpperCase()) >= 0))
          return result;

          private function ContactChanged(evt:CollectionEvent = null):void{
          cbContacts.selectedIndex = 0;