3 Replies Latest reply on Oct 18, 2007 7:48 PM by Newsgroup_User

    Binding a control to a cfc with multiple triggers

    Tinaja
      I'm an old-school coder. I've been trying to figure out the new AJAX controls to see if they could save me some time, but I'm running into headaches.

      At the moment I'm building a tool to reconcile a table full of firstname lastname and organization records (strings, no id's) with 2 other tables that contain organizations and contacts, respectively. IOW, we're trying to match string data with records that have ID's.

      My tool so far has 3 form fields per record - a "this is valid" checkbox and 2 select lists. One for organizations, second for the contacts associated with that org. On load, I bind the org select to a CFC that attempts a direct lookup using the string value of the record, then a SOUNDEX match. Now, when the select list gets loaded, I want to use the first matched record's ID to lookup contacts for that org. How do I tell the second select list to wait until the first one is loaded before doing its lookup, and to do another lookup anytime that value changes? What if I wanted to also link the lookup functionality to the checkbox 's onChange event? I may want to add a separate checkbox so there is one for org and one for contact in case an org exists but the contact doesn't.
        • 1. Re: Binding a control to a cfc with multiple triggers
          Level 7
          Tinaja wrote:

          > My tool so far has 3 form fields per record - a "this is valid" checkbox and 2
          > select lists. One for organizations, second for the contacts associated with
          > that org. On load, I bind the org select to a CFC that attempts a direct
          > lookup using the string value of the record, then a SOUNDEX match. Now, when
          > the select list gets loaded, I want to use the first matched record's ID to
          > lookup contacts for that org. How do I tell the second select list to wait
          > until the first one is loaded before doing its lookup, and to do another lookup
          > anytime that value changes? What if I wanted to also link the lookup
          > functionality to the checkbox 's onChange event? I may want to add a separate
          > checkbox so there is one for org and one for contact in case an org exists but
          > the contact doesn't.
          >

          1) in your contacts cfselect make sure you have specified
          bindonload='false' - this will prevent it from loading any data on
          pageload, before an entry in your organisations list is selected

          2) in its bind argument add @change to the bind parameter: i.e.
          bind='cfc:path.to.your.cfc.method({formcontrolname@change})' - this will
          make it re-lookup data on each change in the organisations list (it may
          be that @change is even default event, so you may not even have to add
          it at all... can't remember now if it is change or click that is default...)

          3) how do you want to link your select lists to your check boxes? what
          action should the change in the state of a checkbox trigger?

          --

          Azadi Saryev
          Sabai-dee.com
          http://www.sabai-dee.com
          • 2. Re: Binding a control to a cfc with multiple triggers
            Tinaja Level 1
            onChange I would think. Thanks for the help. I was able to get this far, but I still don't know how to add the second triggers.
            • 3. Re: Binding a control to a cfc with multiple triggers
              Level 7
              Tinaja wrote:
              > onChange I would think. Thanks for the help. I was able to get this far, but I still don't know how to add the second triggers.

              what second trigger do you want to add?

              basic bind code is like:
              bind="cfc:path.to.cfc.method({trigegr1},{trigger2},...,{triggerN},someintegervalue,'somest ringvalue')"

              your called cfc method must accept N+2 arguments in pre-defined order

              --

              Azadi Saryev
              Sabai-dee.com
              http://www.sabai-dee.com