You could make a copy of the model initially using

var DataModelCopy:Object = mx.utils.ObjectUtil.copy(DataModel);

then in your clear method you could do...

this.DataModel = DataModelCopy;

havn't tested it ... but it should work

On 7/11/06, Erich Cervantez <[EMAIL PROTECTED]> wrote:

In HTML forms, you can set a clear or reset button that wipes out the contents of any form fields.  In Flex, the concept is a little different.  Right now, I have a flex form bound to a data model (and back to the TextInput field as illustrated below).

 

< mx:Model id = "DataModel" >

   < FirstName > { FirstName.text } </ FirstName >

   < LastName > { LastName.text } </ LastName >

   < MiddleName > { MiddleName.text } </ MiddleName >

</ mx:Model >

 

< mx:FormItem label = "First Name" >

   < mx:TextInput id = "FirstName" text = "{ DataModel.FirstName }" />

</ mx:FormItem >

 

I tried creating a destroy() reset method by setting the data model to "undefined".  This doesn't appear to work.  It populates each TextInput field with "undefined" and seems to permanently unbind the data model from the form.  I don't see any methods that I could use to reset these fields under mx:Form.  Is there another option I'm not thinking of, or do I have to loop through each TextInput, ComboBox and other form fields to manually reset their values back to default?

 

Erich Cervantez

Las Vegas, NV

 


__._,_.___

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





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to