Skip to Content
avatar image
Former Member

How to clear controls and value when navigating between screen.

Hi all,

I have developed a small application for practice which has login screen and once logged there will be sign out button.following are my questions

  • When i click sign out now i simple navigated to the home login page using APP.to  but how to make sure when i click sign out i clear the variable are screens and return to home login page.
  • When try to navigate to already existing page i get error saying cannot create duplicate controls and does not navigate to next screen.I am using XML views
  • What the performance related to tips to be take care while create controls and navigating across views

Thanks

Deepan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 03, 2015 at 09:37 PM

    Hi Deepan

    In this example, we show that we can use a model to clear the value of a dialog. You may want to adapt it to your case. Of course, you can clear the value. However, we always advocate using model so that we have the MVC in place; and make your implementation cleaner. That's it does not matter, you have using a input control or other controls. So long as the value in the model is clear, the value of the control will be clear accordingly.

    Hope this helps.

    Thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 03, 2015 at 01:55 PM

    Hello Deepan,

    For clearing a variable, here is an example using an input control, button, and function. Let's say the input control and button are defined in the XML view as follows,

    <Input id="idInput" value="User" />

    <Button press="handleLogOut" />

    In the controller's handleLogOut function, you can get the view, get the input control by id, and set the value:

    handleLogOut : function(){

      this.getView().byId("idInput").setValue("");

    }

    For duplicate controls, it sounds like duplicate ids are being created. This could happen if you use the same id="x" in an XML view or if controls are being created programmatically with duplicate ids.

    For performance tips...that's a good question. Usually, we troubleshoot poorly performing examples, but it would be good to locate a collection of best practices.

    Regards,

    Scott

    Add comment
    10|10000 characters needed characters exceeded