5 Replies Latest reply on Sep 9, 2009 6:41 AM by Ferrari_hunk

    Reset button in Flex



      I am new to flex.

      I have an experience in working with HTML.

      In HTML we have a "reset" type of button, which reset to the previous values.

      Is it possible in flex?

      I want to do that functionality.


      Any help appreciated.




        • 1. Re: Reset button in Flex
          Andrew Rosewarn Level 3

          Hi there


          Yes its possible.  Theres no reset button as such.  What you'd need to do is add a button and on its click event write a function to clear all of the fields in your form.


          Hope that helps



          • 2. Re: Reset button in Flex
            sergei_developer Level 1

            Check this example:


            <?xml version="1.0" encoding="utf-8"?>
            <!-- http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/ -->
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                        import mx.controls.Alert;

                        private function reset():void {
                            answers.selection = null;

                        private function check():void {
                            if (answers.selectedValue) {
                            } else {

                <mx:RadioButtonGroup id="answers" />

                <mx:Form backgroundColor="red">
                        <mx:Text id="question"
                                text="Question..." />
                        <mx:RadioButton id="answer1"
                                label="Answer 1" />
                        <mx:RadioButton id="answer2"
                                label="Answer 2" />
                        <mx:RadioButton id="answer3"
                                label="Answer 3" />
                        <mx:RadioButton id="answer4"
                                label="Answer 4" />
                        <mx:RadioButton id="answer5"
                                label="Answer 5" />
                    <mx:FormItem direction="horizontal">
                        <mx:Button label="Check" click="check();" />
                        <mx:Button label="Reset" click="reset();" />


            If this post answers your question or helps, please mark it as such.
            • 3. Re: Reset button in Flex
              Gregory Lafrance Level 6

              It depends on what you want. If you want to clear a bunch of TextInput, set a ComboBox to the selected value it had when the app first started, you need to code all that reset behavior in a method and then call that method as a click event handler for a Button.


              Depending on your intended behavior, you could use deep linking, which can be difficult to get to work, but once you do its great.






              If this post answers your question or helps, please mark it as such.

              • 4. Re: Reset button in Flex
                gandhi.tush Level 1

                Hi Guys,

                I think there is confusion between what I am asking and what you have answered.

                You guys are talking about the Clearing the values  of textinput or combox. But I am talking about the resetting functionality.


                These two are different things. Let me give the example:


                "Suppose I have one Textbox which have prepopulated value as "ABC" or whatever during page load in browser. Then I have changed that value to "XYZ". And after that I clicked on "Reset Button". The behaviour of the reset button will be to restore the "ABC" in text input instead of clearing the value."


                This is the behaviour of the reset button in HTML. I want this type of behaviour.

                Is it possible in Flex or not?


                Any help appriciated.



                Tushar Gandhi

                • 5. Re: Reset button in Flex

                  Hi Thushar,


                  What you would need to do is, create a function (that will assign the pre load values of every field) and call this function on the click of a custom button that you create. From what it seems, I dont think there is a "reset" button that does this job automatically.