blackberry-10blackberry-cascades

How to pass a var from one page to another in blackberry 10 cascades?


How to pass a data (ex userid ) from one page to another page in blackberry 10 qml ?


Solution

  • You can either create property on target page or create a java script function to do so. If you want to validate or perform any other operation before assigning you should use java script function.

    Page {
        //targetPage
    
        property string userid //you can also use alias here
    
        function initialize(id) {
            userid = id
            //you can also set property of controls here
        }
    }
    

    Call it on your page like this

    targetPageid.userid = "user id"
    

    OR

    targetPageid.initialize("user id")