6 Replies Latest reply on Oct 15, 2009 8:34 AM by RosieGp

    add pop up

    RosieGp Level 1

      I have a portion in the form that I want to add if the user has multiple records...

      For example:







      <mx:Label x="10" y="611" text="Information" fontWeight="bold"/>






      <mx:ComboBox x="10" y="625" prompt="Make a Selection"></mx:ComboBox>






      <mx:Label x="10" y="645" text="Part A" fontWeight="bold" >






      <mx:RichTextEditor x="10" y="663" title="Record A" height="249" width="454">












      <mx:RichTextEditor x="472" y="663" title="Record B" height="249" width="518">







      <mx:Label x="10" y="645" text="Part B" fontWeight="bold" />





      x="878" y="625" label="Add New Record"/>

      So if the user wants to add a new record... the user can hit Add New Record Button and everything after the first Label is re-generated...

      How can i do that?

      Any help is appreciated...

        • 1. Re: add pop up
          Gregory Lafrance Level 6

          If this post answered your question or helped, please mark it as such.



          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            creationComplete="addRecord();" width="100%" height="100%">
                import mx.controls.*;

                private function addRecord():void{
                  var vb:VBox = new VBox();
                  vb.setStyle("backgroundColor", "0xFFFFFF");
                  var infoLbl:Label = new Label();
                  infoLbl.setStyle("fontWeight", "bold");
                  var selectCbx:ComboBox = new ComboBox();
                  selectCbx.prompt = "Make a Selection";
                  var partA_Lbl:Label = new Label();
                  partA_Lbl.text = "Part A";
                  partA_Lbl.setStyle("fontWeight", "bold");
                  var recordA_Rte:RichTextEditor = new RichTextEditor();
                  recordA_Rte.title="Record A"
                  var recordB_Rte:RichTextEditor = new RichTextEditor();
                  recordB_Rte.title="Record B"
                  var partB_Lbl:Label = new Label();
                  partB_Lbl.text = "Part B";
                  partB_Lbl.setStyle("fontWeight", "bold");
                  var hr:HRule = new HRule();
                  hr.setStyle("strokeWidth", 2);
                  hr.setStyle("strokeThickness", 2);
                  hr.percentWidth = infoVB.width;
                  infoVB.addChildAt(hr, 0);
                  infoVB.addChildAt(vb, 0);
            <mx:Button x="878" y="625" label="Add New Record" click="addRecord();"/>
            <mx:VBox id="infoVB" verticalGap="15" horizontalAlign="center"/>

          • 2. Re: add pop up
            RosieGp Level 1

            How do I get data in the combobox ?
            For example selectCbx.dataprovider="{Data}" this generate {Data} when I click the combobox....

            • 3. Re: add pop up
              Gregory Lafrance Level 6

              Actually, in the code I provided the ComboBox is not assigned a dataProvider, so you need to figure out how you will do that. So a question I might ask is, when the user clicks the "Add New Record" button, where will the data to assign as the new ComboBox dataProvider come from?


              After that is solved, then if the user has added several records, and they change the selected item for one of the comboboxes, if you have assigned a change handler for the comboboxes, you can access the ComboBox(event.currentTarget).dataProvider to the data for that ComboBox whose value was changed.

              • 4. Re: add pop up
                RosieGp Level 1

                for the combobox the data is coming from Sql Database: hence the query

                my NEWRECORD.cfc has

                Select distinct RecordHeaders

                From RecordsDB

                so I have it as:


                [Bindable] public var rhdata:ArrayCollection;

                private function resultNR(event:ResultEvent):Void{



                <mx:ComboBox promt="Make a selection" dataProvider=''{rhdata}"/>

                Ofcourse there is a RemoteObject Connection to the ColdFusion server...

                This is what I have, there is no current target that I have....


                • 5. Re: add pop up
                  Gregory Lafrance Level 6

                  I don't see the connection between the DB call and the ComboBoxes. You have to make this more clear for me to be able to comment.

                  • 6. Re: add pop up
                    RosieGp Level 1

                    In cfc I have the following:



                    Select distinct RecordHeaders

                    From RecordsDB


                    In mxml component:


                    [Bindable] public var rhdata:ArrayCollection;

                    private function resultNR(event:ResultEvent):Void{




                    Here is the connection string:






                    id="cf" destination="ColdFusion" source="cfc.NR">



                    <mx:method name="getNR" result="resultNR(event)" fault="Alert.show(event.fault.message)"/>





                    <mx:ComboBox promt="Make a selection" dataProvider=''{rhdata}"/>