I normally use a function like... private function resetFormItems():void { var formChildren:Array = jobRequest.getChildren(); for each(var theFormItem:FormItem in formChildren) { (theFormItem.getChildAt(0) as TextInput).text = ""; } }
This way I don't need to worry about adding new form items to the clear function. HTH. Steve --- In flexcoders@yahoogroups.com, "smccran" <s_mcc...@...> wrote: > > Hi all, > > I have a standard flex form, and I want to do a simple 'reset' function. > > At the moment I would simply set each field value as blank like this: > > private function clear():void > { > nameField.text = ""; > tel.text = ""; > email.text = ""; > > } > > <mx:Form x="10" y="105" id="jobRequest"> > <mx:FormItem label="Name" required="true"> > <mx:TextInput id="nameField"/> > </mx:FormItem> > <mx:FormItem label="Tel" required="true"> > <mx:TextInput id="tel"/> > </mx:FormItem> > <mx:FormItem label="Email" required="true"> > <mx:TextInput id="email"/> > </mx:FormItem> > > Is there a better way of doing this? Or a way I can just say jobRequest.reset? where 'jobRequest' is the form name. > > Thanks > Shaun >