Switch form state : Form State « Components « Flex






Switch form state

Switch form state
          
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Panel title="Sign In" id="signinPanel" fontSize="12">
        <mx:Form id="loginForm">
            <mx:FormItem label="Email:" id="emailItem">
                <mx:TextInput id="emailText" />
            </mx:FormItem>
            <mx:FormItem label="Password:" id="passwordItem">
                <mx:TextInput id="passwordText" displayAsPassword="true" />
            </mx:FormItem>
        </mx:Form>
        <mx:ControlBar>
            <mx:LinkButton id="forgotPasswordLink" label="Forgot password?" click="currentState='RequestPassword'" />
            <mx:Spacer width="100%" id="spacer" />
            <mx:Button label="Sign in" id="signinButton" />
        </mx:ControlBar>
    </mx:Panel>
    <mx:states>
        <mx:State name="RequestPassword">
            <mx:SetProperty target="{signinPanel}" name="title" value="Request New Password" />
            <mx:SetProperty target="{signinButton}" name="label" value="Submit" />
            <mx:RemoveChild target="{forgotPasswordLink}" />
            <mx:AddChild relativeTo="{spacer}" position="before">
                <mx:target>
                    <mx:LinkButton id="signInLink" label="Return to Sign In" click="currentState=''" />
                </mx:target>
            </mx:AddChild>
            <mx:RemoveChild target="{passwordItem}" />
        </mx:State>
    </mx:states>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Set and get form stateSet and get form state
2.Add Form control in stateAdd Form control in state
3.Change form control property in stateChange form control property in state
4.Highlight new added form item during state changingHighlight new added form item during state changing