I would use an array of objects to hold different entries. Send the
array to backend for processing in one shot...
 
public class BasicInformation
{
        public var eventDate:String;
        //similarly other fields.

        public function BasicInformation(eventDate:String //, similarly
other fields)
        {
                this.eventDate = eventDate;
                
        }
}
 
So whenever someone adds another row, you push the data in model to an
array:
 
private var basicInformation:Array = new Array();
 
function addBasicInformation()
{
    basicInformation.push( new BasicInformation(
        
basicInformationModel.eventDate,
        
basicInformationModel.facilityDate,
        
basicInformationModel.sacActual,
        
basicInformationModel.sacPotential
                                                                );
}
 
 
You can also create custom component to hold the form-fields:
 
<mx:HBox height="100%" width="100%">
<mx:TextInput id="txtRCAParticipants1" width="150" text="" />
<mx:TextInput id="txtTitle1" width="150" text="" />
<mx:ComboBox id="cmbTeamRole1" width="100">
      <mx:dataProvider>
            <mx:Array>
                  <mx:String></mx:String>
                  <mx:String>Leader</mx:String>
                  <mx:String>Member</mx:String>
                  <mx:String>Advisor</mx:String>
            </mx:Array>
      </mx:dataProvider>
</mx:ComboBox>
<mx:TextInput id="txtPhoneNumber1" width="150" text="" />
<mx:Spacer width="20" />
<mx:Button label="Delete" click="" />
</mx:HBox>

 
Then you can reuse it, right now you have hardcoded first set.


There could be better approach, above is just quick idea...

-abdul
 
 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, January 25, 2006 12:08 AM
To: [email protected]
Subject: [flexcoders] Multiple values in a data model


I have an application I am working on where the user can input 
information into various text input fields layed out in a HBOX. If 
the user needs to add another person for the input they click on an 
add event that dynamically creates another row. 

My question is what is the best way to tie multiple entries to the 
data model? If there is only a one line entry it would be no problem, 
but what do you do when you want a data model to hold mulitple 
entries from dynamically created input fields to be re-used 
throughout the app or sent back to the database? 

Any suggestions would be appreciated.

Thanks,

**********************************************
                    MY CODE
**********************************************

<?xml version="1.0" encoding="utf-8"?>
<mx:Application height="25" 
xmlns:mx="http://www.macromedia.com/2003/mxml";>

<mx:Model id="basicInformationModel">
      <EventDate>{txtRCAParticipants1.text}</EventDate>
      <FaciltyDate>{txtTitle1.text}</FaciltyDate>
      <SacActual>{cmbTeamRole1.selectedItem}</SacActual>
      <SacPotential>{txtPhoneNumber1.text}</SacPotential>
      
</mx:Model>

<mx:Script>
<![CDATA[
        var participantRowArray : Object = new Array() ;
      var participantCounter : Number = 0 ;

          //----------- RCA Participants --------------
      private function addRCAParticipantsRow():Void
            {
                  participantRowArray[participantCounter] = 
Components.charterMemoParticipantsEntry
(participantsRowHolder.createChild
(Components.charterMemoParticipantsEntry,undefined, null ) );
                  participantCounter++;
            }
      
]]>
</mx:Script>

<mx:HBox>
                                          
      <mx:Label text="3.) RCA Participants" width="150"/>
      <mx:Label text="Title" width="150"/>
      <mx:Label text="Team Role" width="100"/>
      <mx:Label text="Phone #" />
      <mx:Button label="Add" width="60" click="addRCAParticipantsRow
();"/>      <mx:Button label="Delete" width="60" 
click="deleteRCAParticipantsRowRow();"/>
</mx:HBox>
<mx:HBox height="100%" width="100%">
<mx:TextInput id="txtRCAParticipants1" width="150" text="" />
<mx:TextInput id="txtTitle1" width="150" text="" />
<mx:ComboBox id="cmbTeamRole1" width="100">
      <mx:dataProvider>
            <mx:Array>
                  <mx:String></mx:String>
                  <mx:String>Leader</mx:String>
                  <mx:String>Member</mx:String>
                  <mx:String>Advisor</mx:String>
            </mx:Array>
      </mx:dataProvider>
</mx:ComboBox>
<mx:TextInput id="txtPhoneNumber1" width="150" text="" />
<mx:Spacer width="20" />
<mx:Button label="Delete" click="" />
</mx:HBox>
</mx:Application>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 



________________________________

YAHOO! GROUPS LINKS 


        *        Visit your group "flexcoders
<http://groups.yahoo.com/group/flexcoders> " on the web.
          
*        To unsubscribe from this group, send an email to:
         [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
          
*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 


________________________________




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to