To make a copy use: 
newContact = ObjectUtils.copy( pendingContact );
 
You can definitly work with it as you wrote below.... or use FDS which can do 
this for you :)
 
Dimitrios Gianninas
Developer
Optimal Payments Inc.
 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Sent: Monday, March 26, 2007 1:51 PM
To: [email protected]
Subject: [flexcoders] Two-Way Binding Solutions?



I have trying to figure out how best to accomplish the two-way data 
binding needed for form entry. Here is what I thought would work, 
but it doesn't seem to:

ON MODEL:
I created two variables that hold my VO.

model.pendingContact
model.newContact

The user clicks a button to get ContactVO data from the server. In 
the command class I assign the result (which is a typed PHP 
ContactVO) to each variable:

model.pendingContact = data.result;
model.newContact = data.result;

I then bind my form fields to "model.pendingContact" so that the 
existing values from the server show up in the TextInput fields.

Lastly, I use the BindingUtil methods to bind the "text" property of 
the TextInput fields back to "model.newContact" so that I can record 
any changes and send them back to the server.

When the user submits the form, "model.pendingContact" should hold 
the old values & "model.newContact" should have the new values. 
Correct??

Am I overlooking something. The only way I can get this to work is 
if I don't assign "model.newContact" to the values from the server 
and instead create a new instance like this:

model.pendingContact = data.result;
model.newContact = new ContactVO;

However, I can't do this because I need the newContact to start out 
with the old values from the server. Is there a duplicate or clone 
object method that I need to use so that both model variables can be 
assigned to the same object from the server??

Thanks for the help.

- Kevin


 

-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

Reply via email to