Results 1 to 7 of 7

Thread: Passing parameter to Cloud App

  1. #1
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,948

    Passing parameter to Cloud App

    I thought I read something about this and can't find it.

    What I want to do is make a call like this from a browser (or link):

    Code:
    http://localhost:8001/myapp?mybase64encodedquerystring
    and pick it up in the INIT of the app, where I will then do things with it before anything else happens in the app.

    The app would be set to public access, so the login screen would not appear. The querystring would be used for validation and other purposes.

    I tried using:

    $_SERVER["querystring"] in the INIT of the app without success. The code that checked for $_SERVER being defined and not null skipped right around the Lianja.showMessage I was using to test.

    thanks,

    Hank

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Hi Hank

    $_SERVER is a server side array. It cannot be accessed in the client.

    if you need to access the uri which was called to run the app from inside the app itself in the client you should access the uri from the ready delegate on the client.

    if (typeof LianjaAppBuilder !== Ďundefinedí) return; // ignore in dev mode
    var url = window.location.href;
    // now extract the args and do as you will with them
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Hi hank

    One other solution would be to add a server side delegate that gets called when an app is run e.g call a validaterequest.prg if it exists in the app directory.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,948
    Hi Barry,

    thanks.

    Is there any way to retrieve the _server.query_string from the server? The idea is to be able to pass a parameter to an app.

    The Use Case is the user clicks a button in an email with a magic token as the query_string and goes directly into what is actually a Lianja App but looks like a fancy web page -- and of course is responsive so can run on mobile.

    thanks,

    Hank

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Hi Hank,

    In your ready delegate you have that information available to you:

    Code:
    var query_string = "";
    var href = window.location.href;
    var pos = href.indexOf("?");
    if (pos > 0) query_string = href.substring(pos+1);
    var argv = query_string.split("&");
    for (var i=0; i<argv.length; ++i)
    {
        arg = argv[i].split("=");
        argname = arg[0];
        argvalue = arg[1];
    }
    



    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,948
    Wonderful! That does the trick. If you hadn't had a chance to respond, I was going to follow up on window.location to see what else was there, but I was tied up for the evening.

    I said many kind and true things about you tonight to a couple friends/developers. I hope you noticed. We're in the process of forming a cooperative of small shops of data experts, like us, and meet weekly on Zoom.

    thanks,

    Hank

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Glad itís useful
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us