How to switch from different views when a common button is clicked on using View states concept

Hi
i have  made a single form for both Login Screen and Registration screen with two states :
1. BaseState which is the curret state of  state of My application
2.registrationstate 
I have a common button for changing from one view to another view .(Not related to any of the state)
At first the Login screen is loaded , and when the common  button is clicked , i want to switch to Registration Screen .
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
    <![CDATA[
// Logic for common button needed .
    public function handleMe(event:MouseEvent):void
    ]]>
</mx:Script>
    <mx:states>
        <mx:State name="registrationstate">
            <mx:SetProperty target="{formitem1}" name="label" value="Email"/>
            <mx:SetProperty target="{button1}" name="label" value="Change state to Login"/>
        </mx:State>
    </mx:states>
    <mx:Form x="248" y="158">
        <mx:FormItem label="User Name" fontWeight="bold" id="formitem1">
            <mx:TextInput/>
        </mx:FormItem>
    </mx:Form>
<!-- This is my coomon button-->
    <mx:Button
        click="handleMe(event)"  
        x="297" y="261" label="Change state to Registration" id="button1"/>
</mx:Application>

Originally I could not get that to work, but now I have it working:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  <mx:Script>
    <![CDATA[
      import mx.controls.Alert;
      public function handleMe(event:MouseEvent):void{  
        trace(this.currentState); 
        if(currentState=="" || currentState == null){
          mx.controls.Alert.show("base state");
          currentState = "registrationstate"; 
        }else if(currentState=="registrationstate"){
          mx.controls.Alert.show("registrationstate");
          currentState = ""; 
    ]]>
  </mx:Script>
  <mx:states>
    <mx:State name="registrationstate">
      <mx:SetProperty target="{formitem1}" name="label" value="Email"/>
      <mx:SetProperty target="{button1}" name="label" value="Change state to Login"/>
    </mx:State>
  </mx:states>
  <mx:Form x="248" y="158">
    <mx:FormItem label="User Name" fontWeight="bold" id="formitem1">
      <mx:TextInput/>
    </mx:FormItem>
  </mx:Form>
  <mx:Button click="handleMe(event)" x="297" y="261"
    label="Change state to Registration" id="button1"/>
</mx:Application>
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex / AIR Development, Training, and Support Services

Similar Messages

  • How to make the session expire when the refresh button is clicked

    Hi All,
    I am writing a Struts application where I want the session to expire when the user clicks refresh button or refresh the page by hitting F5, like any Bank sites. Any help will be appreciated.

    The trick isn't invalidating the session. The trick is detecting refresh requests.
    The Synchronizer Token pattern can handle this.
    Struts can do this for you. Check out [this article|http://www.javaworld.com/javaworld/javatips/jw-javatip136.html?page=1]
    Cheers,
    evnafets

  • Dreamweaver CC crashes when switching from code view to design view

    I am experiencing a recent problem with a file I am currently working. When I switch from code view to design view Dreamweaver crashes and requests a shut down. Other files seem to work without a problem. This particular files has 3 cascading EdgeAnimation CC files that are selected by media queries. I can test the page online without a problem but not in design or live view.

    Since your new page didn't crash, this leads me to believe that you have some critical errors and/or conflicts in your other page(s).
    Try running your code through the W3C validation tools. 
    CSS - http://jigsaw.w3.org/css-validator/
    HTML - http://validator.w3.org/
    Also debug JavaScript. 
    JavaScript - http://www.jslint.com/
    Nancy O.

  • Switching from one View to another in the Portal

    Hi Experts,
    We have created many global views from one query.  We have created these in thr portal.
    Our problem is when we switch from one view to another, it will carry all the filter values from the previous view.  Ideally we only want to pass the values from the variable entry, not the filter values local to the view.
    Does anyone of you knows how to solve this problem?  I am trying to look at the Customer exit... and do something with the mapping.  But this one will affect all the drill-downs.  Any thoughts?
    Best Regards,
    Rose

    Hi,
    I have somehow solved it using the exit.  In this case the source and target query is really the same because we are just switching from one view to another using the the same query.  What I did in the exit was:
    -  If the source and target query are the same.
    -  remove all the mappings except the ones with object types "Variables".
    This ensures that:
    1) I only apply this logic if the source and destination query is the same.
    2) The restrictions that will be applied to the destination view when I switch
    from one view to another will always be only be the paramater values
    (default or entered by the user) when they first run the query.
    Best Regards,
    Rose

  • HT5622 How to switch from one apple store to another

    How to switch from one apple store to another

    Follow this procedure:
    1. Go to Settings > iTunes & App Stores > Apple ID.
    2. Tap your Apple ID.
    3. Tap View Apple ID.
    4. Enter your password.
    5. Go to Country/Region in the popup window to change to the desired store.
    See also: http://support.apple.com/kb/HT1311

  • How to switch from text message to iMessage for 1 contact

    I have one friend with an iPhone who all of the sudden in my messaging has switched from iMessage to text messages with working WiFi on and stable, on my iPhone 5 (iOS 7.1.2).  This is not a cellular or wifi issues, I guarantee, I am iMessaging other people without problem. She is also iMessaging other people without problem.
    I have tried all work arounds I've seen on the web including:
    -turning iMessage on and off, turning the phone on and off
    -deleting all conversation with her and then sending a new message
    -labeling the contact as an "iPhone" on my iPad (doesn't seem to switch label to  "iPhone" and "iPhone" is no longer available as a label on iPhone)
    -sending an iMessage on my iPad to her and then trying to use same message stream on the iPhone
    This is beyond ridiculous that there is no way to switch from text to iMessage, I know how to switch from iMessage to text when the "error" comes up that it can't be sent as in iMessage.  Any ideas?

    You didn't mention trying these two steps:
    If the issue occurs with a specific contact or contacts, delete and recreate the contact in the Contacts app. Create a new message to the newly created contact and try again.
    Back up and restore your device as new.
    ... which are listed as steps 4 and 5 near the middle of this article:
    iOS: Troubleshooting Messages

  • How to switch from a word doc to another using a keyboard shortcut?

    how to switch from a word doc to another using a keyboard shortcut?

    Cmd+tilde to switch between open Word documents, or
    Cmd+tab to switch between open applications, if that's what you are after?

  • I am a brand new mac user...trying to figure out how to switch from the Mac Pro screen to my external monitor.  Appreciate any help.

    am a brand new mac user...trying to figure out how to switch from the Mac Pro screen to my external monitor.  Appreciate any help.  thanks

    In Finder... goto Help... In the Search Window type in Displays...
    Lots of Useful Information there...
    You may find these Links Useful too:
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/macbookpro/
    Cheers,

  • How to switch from  one Data base to another data base

    Hi,
    How to switch from one Data base to another data base if first data base server like in restoring,blocking,network disconnected state.
    Please help out for the same.
    Regards,
    Anilkumar

    Sounds like a problem for forums/support from the DB provider, as this problem is normally solved through some form of HA provided by the DB (or some cluster software, but still not Java) with, normally, a shared (virtual) IP address.

  • I bought yesterday the software MacFamilyTree 7. How to switch from English to French?

    I bought yesterday from the French ITunes store "MacFamilyTree 7. v.7.0.
    My question is "How to switch from English to French?
    I am using Mcbook Air with up dated Mountain Lion

    These applications use your system language, so you have to change the language. Go to System Preferences > Language and Text > Language, and move French to the first place. The next time you start Mac OS X, it will start up in French, and your application will show up in French

  • How can I set a value in a field before create when a New button is clicked

    Hi,
    I am using
    JDeveloper 10.1.3.1.0.3984 and
    JHeadstart 10.1.3.1 release 10.1.3.1.26
    I have one group and there is a detail group under that group.
    From main group to detail group there are 3 field relating those groups.
    field1
    field2
    fieldSEQ (auto-generated by database trigger)
    These 3 fields are PK.
    In the detail group, there is a New button. So, when the New button is clicked, it tries to create the record with those 3 fields value as those are coming from main group. As a result it's giving the duplicate error as that record already exists in the table.
    But I don't want to create the record with that SEQ as that will be created in the trigger.
    How can I set the SEQ temporarily any no. (-1) before create when the New button is clicked?
    Can anybody help?
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    Hello Syad,
    What I would suggest is setting the sequence number at the creation of the entity object (so in the create() method) by using the database sequence. This way it will always be unique.
    So something like:
    protected void create(AttributeList AttributeList) {
    super.create(AttributeList);
    SequenceImpl sequence =
    new SequenceImpl("KCP_SEQ", getDBTransaction());
    setFieldSeq( sequence.getSequenceNumber());
    If this still does not solve it: please go to the ADF Forum since this problem is an ADF problem, not a JHeadstart problem.
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team.

  • How to switch off screen blocking if I forget password and couldn't use iTunes?

    How to switch off screen blocking if I forget password and couldn't use iTunes?

    If you are saying that you've forgotten the passcode to unlock the iPad then you will need to connect the iPad to the computer that you normally sync to and you should then be able to reset the iPad and restore/re-sync your content to it (http://support.apple.com/kb/HT1212) - you may need to put the iPad into recovery mode for your iTunes to be able to reset it : http://support.apple.com/kb/ht1808
    If you do it via a different computer then :
    If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present.

  • ADF/JSF page loads when any command button is clicked

    Hello All,
    I am lost in the ADF/JSF page flow (using Jdev 10.1.3). Following are the tags (in order) in my page;
    (WHEN THIS PAGE LOADS, IT GOES TO THE DATABASE TO GET VALUES (for the drop down lists that will appear on the page); THIS SHOULD HAPPEN JUST ONCE AND AT THIS POINT)
    <f:view>
    <afh:body>
    <afh:html>
    <af:form>
    <af:panelpage>
    <f:facet name="contextSwitcher">
    <af:panelHorizontal> has a af:commandLink </af:panelHorizontal>
    </f:facet>
    <f:facet name="messages">
    <af:messages/>
    </f:facet>
    <af:panelform>
    <h:panelGrid columns="2" cellspacing="14">
    has 2 panelgroups (one group has *2 SelectOneChoice lists (that need to be populated by fetching data from database* and the other group has 2 CommandButtons - 'Go' and 'Cancel") (GO BUTTON SETS THE SHOWPANEL() TO TRUE)
    (WHEN GO BUTTON IS CLICKED, THE PAGE GOES TO THE DATABASE (AS IT DID ON PAGE LOAD). *THIS SHOULD NOT BE HAPPENING*. ONLY THE METHOD (action="#{muBean.doWork}" )THAT IS ASSOCIATED WITH GO BUTTON ACTION SHOULD BE CALLED)
    </h:panelGrid>
    <h:panelGrid columns="2" cellspacing="14" rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has 3 inputText fields
    </h:panelGrid>
    <af:table var="someTable" rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has a bunch of af:columns
    </af:table>
    <af:panelHorizontal rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has 3 af:commandButtons - submit, save, add row
    (WHEN submit or save or add row BUTTON IS CLICKED, THE PAGE KIND OF LOADS AND GOES TO THE DATABASE (AS IT DID ON PAGE LOAD). *THIS SHOULD NOT BE HAPPENING*. ONLY THE METHOD THAT IS ASSOCIATED WITH submit/save/add row BUTTON ACTION SHOULD BE CALLED)
    </af:panelHorizontal
    </af:panelForm>
    </af:panelPage>
    <!-- Footer -->
    <jsp:include page="/pages/includes/footer.jspx"/>
    </af:form>
    <f:verbatim>
    <script type="text/javascript" src="../script/tree.js"></script>
    </f:verbatim>
    </afh:body>
    </afh:html>
    </f:view>
    </jsp:root>
    _*why is it that when the command buttons are clicked, the whole page is loaded? Only the methods associated with the action (action="#{newMapRequestItem.addARow}" ) should be called.*_
    _*IS THERE A WAY TO AVOID THIS WITHOUT USING PARTIAL PAGE RENDERING ?*_
    _*DOES MY TAG NESTING LOOK OK?*_
    Edited by: user12054715 on Mar 24, 2010 12:00 PM

    Can somebody please address this?
    Thanks,

  • Need to show popup when the Submit button is clicked for the second time ..

    Hi guys,
    I have a requirement where i need to show a popup or alert when the submit button is clicked twice . When it is clicked for the first time one method is been called and its process starts. When the user clicks the submit button for the second time they should be shown a popup stating "Submit button already been clicked, please clicked OK to continue".
    Can anyone help with this please , its really urgent requirement ?
    Thanks in advance

    Hi,
    I dont have any sample code to give you now. For quick reference, I can advice some psuedo steps to achieve your requirement. I dont have access to JDEV to test this. If any syntax errors then pls correct yourself.
    1. Extend Controller since it is standard page ( Refer Anil Passi site for steps to extend seeded ontroller)
    2. Write below logic in your Process Request method
    super.processRequest(oaPageContext, oaWebBean);
    pageContext.putSessionValue("status", "notInitiated");
    3. Include below logic in your PFR method
    if(pageContext.getSessionValue("status")!=null){
    if("notInitiated".equals(pageContext.getSessionValue("status")))
    super.processFormRequest(oapagecontext, oawebbean);
    pageContext.putSessionValue("status", "initiated");
    else
    String message = "Display error message as required";
    throw new OAException(message, OAException.ERROR);
    You may need to import required packages ( Related to OAException).
    Remeber, to sumbit the request, user need to refresh the page again so that "status" variable will be refreshed.
    Hope it helps.
    Thanks
    venkat

  • Af:statusIndicator does not show busy icon when a command button is click

    Hi Guys,
    af:statusIndicator does not show busy icon or motion when a command button is click
    I am working on an excel data upload functionality on .jspx page. I use “af:inputFile” file uploader to upload an excel file then process the data and store it as a list of objects in memory and display it in “af:table” table
    I added “af:statusIndicator” to the page to show the user that the page is progressing while the data is uploading and when it is saving the data to the database.
    In this case, when the “af:inputFile” is clicked to upload the excel file - the status indicator shows a progress icon (movement) which is expected and is good. However, after the data have been display in the table when I click on a command button that saves the data to the database – I expected the status indicator to start its busy motion but that is not happening. Whereas, the command button grayed out and is disable when I clicked the button until the operation is completed.
    Is there any way to start the statusIndicator when a command button is clicked?
    I tried the following options
    *<af:statusIndicator id="si1_uploadStatus" partialTriggers="pc1:cb1 pc1:table"/>*
    Where pc1:cb1 is the command button and pc1:table is the table
    *<af:commandButton text="Submit Uploads" id="cb1"*
    *disabled="#{!viewScope.batchUploadController.allSavable}"*
    *partialTriggers="::infFilePath"*
    *action="#{viewScope.batchUploadController.saveUploadedData}"*
    *blocking="true"/>*
    Thanks,

    Can somebody please address this?
    Thanks,

Maybe you are looking for

  • Error in Starting WebServer (Ver 7) Admin Server

    Hi, I am getting the error shown below when starting the Webserver 7 admin server. The Web server starts and I can administer the server but when deploying Access Manager getting agan the same java.lang.NoClassDefFoundError and can't AM complete conf

  • IPhoto 08 is gone...can see the icon but doesn't open. Any suggestions?

    I was working on getting my Time Capsule to backup my MacBook and erased everything on there. When I restarted and got the time capsule to work i couldn't open my Iphoto anymore and cannot open any new photos that I download.. If I click on the icon

  • HELP  my Powerbook is password protected

    i got my powerbook second hand and it has a password so any help would be helpful

  • B2B Scenario : Party Identifiers

    Hi all , I have B2B scenario. ( IDOC to Mail) My question is  : Can I have more then one identifier for same Agency and schema pair? XI is not allowing me to configure two identifiers for same Agency and schema pair. Is their any work around for this

  • "This file cannot be found" saving cs6 workspaces??

    I have been using ill for 25 yrs and never ever had ill fail to save/save as/save a copy before! What gives. Is anyone else having this strange problem. meitnik