PDA

View Full Version : Basic Form Reset Question


Jerry62712
11-14-2008, 03:36 PM
I want to add a "reset" button to a form. All the fields on the form are either NumericStepper or ComboBox fields.

I can't seem to find the method for either to reset them to the initial state (either 0 or 1 on the numbers or blank or the first value in the combos.

Nor could I find a method on the form object to do a global reset.

Thanks In Advance,
Jerry

fx.barrett
11-14-2008, 04:24 PM
Simply set it's value to 0:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
<![CDATA[

private function resetHandler(event:MouseEvent):void
{
this.stepper.value = 0;
}

]]>
</mx:Script>

<mx:VBox horizontalCenter="0" verticalCenter="0">
<mx:NumericStepper id="stepper" width="200"/>
<mx:Button label="Reset Stepper" width="200" click="resetHandler(event)"/>
</mx:VBox>

</mx:Application>

Jerry62712
11-14-2008, 05:07 PM
Thanks! Believe it or not I looked for "value" and "data" as properties and "reset()" as a method for both, but didn't see any of them. Maybe time to have the eyes adjusted <g>.

I really appreciate the help.