I have been struggling with this for several hours now, and am at the 
end of my rope.  I am hoping somebody here can help.  I have a flash 
form with 3 <cfselect> controls on it.  2 of the cfselects contain a 
listing of states, which I have just added manually in the form setup 
with a bunch of <option> tags inside the <cfselect>.  The third cfselect 
is populated from a query that runs when the form loads containing the 
names of Internet Service Providers.

I also have a <cfgrid> component that is populated when the form loads 
with a list of customers.  In the onChange event of the grid, I populate 
the controls on the form with the customer details, and also choose the 
correct option from the cfselect controls that correspond to the 
customer record.  The 2 cfselects that I populate manually with the 
names of states work fine, but the cfselect that is populated 
dynamically from a query will not display the appropriate ISP that 
corresponds to the customer record.  It never changes it's value.

Here is some code:
The onchange of the <cfgrid> calls the custGridChanged function:

public function custGridChanged():Void {
    selectOption(provider, custGrid.selectedItem.I_Name);
    selectOption(state, custGrid.selectedItem.CU_State);
    selectOption(billingState, custGrid.selectedItem.CU_bstate);
    ...
    ...
}

You can see this calls another helper function called selectOption to 
find the correct values in the <cfselect>

public function selectOption(cbox:mx.controls.ComboBox, 
optionToSelect:String):Void {
    var itemFound:String;
    itemFound = "no";

    for (var i:Number = 0; i < cbox.length; i++) {
       if (cbox.getItemAt([i]).data == optionToSelect) {
          cbox.selectedIndex = i;
          itemFound = "yes";
          break;
       }
    }
    if (itemFound == "no") {
       cbox.selectedIndex = 0;
    }
}

As I said, this code correctly displays the values for the state combo 
boxes that I manually add values to, but does not find the correct value 
in the ISP combo box that is populated by a query.  The code to populate 
the ISP combo box is as follows:

ispSelect.labelField = "I_Name";
ispSelect.dataProvider = result;  <!--- result is the variable being 
passed back from a CFC containing a recordset of ISPs --->

The ISP combo box does get populated correctly.

Thanks for any help with this, and sorry for the long email.  If there 
is a more appropriate forum I should ask this question, please tell me 
and I'll move it there.

Steve
---
---


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233504
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to