8 Replies Latest reply on Sep 17, 2006 11:12 AM by coderhead

    ComboBox compiles incorrectly

    nyfeman Level 1
      I've got a ComboBox in a FormItem that is filled with an array of U.S. state abbreviations (created in a Script block). When it compiles, every 5th state is blank (e.g., AR [blank] CO). If you click on the blank spot where CA should be, it fills the ComboBox correctly, CA shows up, but obviously this is less than optimal. Also, once I've chosen one, the blanks move around. Anyone seen this error before?

      Al
        • 1. Re: ComboBox compiles incorrectly
          peterent Level 2
          I have not see this. Can you post your code so I can verify it?
          • 2. Re: ComboBox compiles incorrectly
            nyfeman Level 1
            Here it is --

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:comp="Components.*" layout="absolute" creationComplete="initApp()">

            <mx:Script>
            <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.ItemClickEvent;
            import mx.controls.Alert;
            import mx.rpc.events.*;

            [Bindable]
            public var qryResult:ArrayCollection = null;
            [Bindable]
            public var stateArray:Array = ["","AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI",
            "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN",
            "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH",
            "OK", "OR", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA",
            "WA", "WV", "WI", "WY"];
            public function submitName():void
            {

            }
            public function clearInputs():void
            {
            FName.text ="";
            LName.text ="";
            Address1.text ="";
            Address2.text ="";
            Address3.text ="";
            City.text ="";
            State.data ="";
            Zip.text ="";
            Country.text ="USA";
            Email.text ="";
            Joining.selected=false;
            }
            private function initApp():void
            {
            myService.qryRosterData()
            }
            public function resultHandler(event:ResultEvent):void
            {
            qryResult = event.result as ArrayCollection;
            }
            ]]>
            </mx:Script>

            <mx:VDividedBox x="10" y="84" width="958" height="694">
            <mx:Panel width="950" height="340" layout="absolute">

            <mx:Label x="481" y="10" text="Add a person to the Roster:"/>
            <mx:Form x="481" width="405" id="newPersonForm" verticalGap="2" height="274" y="26" paddingLeft="0" paddingRight="0">
            <mx:FormItem label="Name" direction="horizontal" required="true">
            <mx:TextInput id="FName" width="125"/>
            <mx:TextInput id="LName" width="175"/>
            </mx:FormItem>
            <mx:FormItem label="Address">
            <mx:TextInput id="Address1" width="300"/>
            <mx:TextInput id="Address2" width="300"/>
            <mx:TextInput id="Address3" width="300"/>
            </mx:FormItem>
            <mx:FormItem label="City, State" direction="horizontal">
            <mx:TextInput x="541" y="164" id="City" width="206"/>
            <mx:ComboBox id="State" x="709" y="164" width="64" dataProvider="{stateArray}"/>
            </mx:FormItem>
            <mx:FormItem label="ZIP, Country" direction="horizontal">
            <mx:TextInput id="Zip" width="85"/>
            <mx:TextInput id="Country" text="USA"/>
            </mx:FormItem>
            <mx:FormItem label="E-mail">
            <mx:TextInput x="718" y="207" width="230" id="Email"/>
            </mx:FormItem>
            <mx:FormItem label="Joining SAFD">
            <mx:CheckBox id="Joining"/>
            </mx:FormItem>
            <mx:FormItem direction="horizontal">
            <mx:Button id="submitButton" x="650" y="256" label="Add to SPT" click="submitName()"/>
            <mx:Button label="Reset" click="clearInputs()"/>
            </mx:FormItem>
            </mx:Form>
            </mx:Panel>
            • 3. Re: ComboBox compiles incorrectly
              peterent Level 2
              Thanks. I tried it and you are right: gaps appear in the dropdown. I need to investigate this further. I tried a couple of things as a work-around, but they didn't pan out. I'm afraid you'll have to wait a bit.
              • 4. Re: ComboBox compiles incorrectly
                nyfeman Level 1
                Thanks for the response -- I'll keep my eyes peeled!

                Al
                • 5. Re: ComboBox compiles incorrectly
                  inlineblue Level 1
                  Wow, weird one. Ya, I see the gaps too. Seems to happen if you have a blank as the first entry. I changed the blank to a space and the gaps went away.
                  • 6. Re: ComboBox compiles incorrectly
                    peterent Level 2
                    Got it.

                    Either change the first item in your Array from "" to " " (a single space) or remove it altogether and use prompt=" " on the ComboBox tag. The prompt property is fine if you don't want the user to be able to select a blank entry but want to present it that way at the beginning.
                    • 7. Re: ComboBox compiles incorrectly
                      nyfeman Level 1
                      Ah, brilliant. I'll give that a shot.

                      Al
                      • 8. ComboBox compiles incorrectly
                        coderhead
                        I'm so glad I found something similar to the problem I'm having. However, not similar enough (mine is a 1.5 issue). Here's my problem:

                        I've got a BreadcrumbBar component that uses a Repeater to display Breadcrumb components from an Array of custom classes. Each Breadcrumb component displays a separator Image and a ComboBox with a change event handler, like so:

                        BREADCRUMBBAR:
                        <mx:Repeater id="breadcrumbRepeater" dataProvider="{_parentCategories}" recycleChildren="true">
                        <ui:Breadcrumb categoryData="{breadcrumbRepeater.currentItem}" select="handleBreadcrumbSelect( event )" />
                        </mx:Repeater>

                        BREADCRUMB:
                        <mx:ComboBox dataProvider="{_categoryData.childCategories}" labelField="name" prompt="-- Select One --" change="handleBreadcrumbSelect( event )" />

                        When I have a single Breadcrumb, everything is fine and I'm happy. When the second Breadcrumb is added, the first Breadcrumb is completely shot. What I end up with, instead of a ComboBox with a prompt and n items, is a ComboBox with 12 prompts and none of the original items. What's the deal with that? Each time I add a Breadcrumb, the previous lists are populated with more and more prompts.