Can I add an arbitrary parameter into LANSA Web plugin page? (RESOLVED)

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Taku Izumi
Posts: 19
Joined: Thu Dec 15, 2016 2:03 pm

Can I add an arbitrary parameter into LANSA Web plugin page? (RESOLVED)

Post by Taku Izumi » Tue Oct 15, 2019 7:37 pm

Hi,

I created my web page according to this site (https://docs.lansa.com/14/en/lansa017/i ... 1_0205.htm).

Can I want to add an arbitrary parameter (for example: employeenumber=A0000) to the page?

If it possible, please let me know it.

Best regards,
Taku

jyoung
Posts: 657
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Post by jyoung » Wed Oct 16, 2019 12:23 am

Are you referring to QueryString Parameters?

If so, then check out https://docs.lansa.com/14/en/lansa017/i ... 1_0290.htm

Joe

JamesDuignan
Posts: 66
Joined: Thu Nov 26, 2015 1:43 pm

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Post by JamesDuignan » Wed Oct 16, 2019 11:11 am

Hi Taku,

To add the parameters onto the url you will want to use the PRIM_WEB.history.add method. This allows you to add name value pairs to the url.
https://docs.lansa.com/14/en/lansa016/p ... ry_add.htm

For example:

Code: Select all

Evtroutine Handling(#EmpList.ItemGotSelection)

#SYS_WEB.History.Add( ("EMPID=&1").Substitute( #xEmployeeIdentification ) )

Endroutine
Then to access the parameters you can access the instance of the parameter name that you want from a PRIM_WEB.URLChangedEvent
https://docs.lansa.com/14/en/lansa016/p ... meters.htm
https://docs.lansa.com/14/en/lansa016/p ... hanged.htm

For example:

Code: Select all

Evtroutine Handling(#SYS_WEB.URLChanged)

If (#SYS_WEB.URLParameters<EMPID> *IsNot *NULL)

#Empdetail.ShowEmployee( #SYS_WEB.URLParameters<EMPID>.value )

Endif

Endroutine
Regards,
James

Taku Izumi
Posts: 19
Joined: Thu Dec 15, 2016 2:03 pm

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Post by Taku Izumi » Wed Oct 16, 2019 6:27 pm

Hi,

Thank you for the tips.
I explain what I want to do again.
I would like to add a parameter to below HTML source.

Code: Select all

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <meta name="mobile-web-app-capable" content="yes">
      <meta name="apple-mobile-web-app-capable" content="yes">
      <meta name="apple-touch-fullscreen" content="yes">
      <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
   </head>
   <body>
      <script>
         (function(){ window["LANSA"] = {nonce: ""}; })();
      </script>
      <script src="/dcxpgmlib/lansa_14_2_4_1/lansa.js"></script>
      <script>
         (function(LANSA){
            if(!LANSA){document.write("Failed to load /dcxpgmlib/lansa_14_2_4_1/lansa.js");return}
            LANSA.init({part:"dem",sys:"dcxpgmlib",ver:"631280881",lang:{def:"JPN",code:{"JPN":"ja-JP","ENG":"en-US"}},slz:0,md:1,splash:{limg:"spin",mtxt:{"JPN":"ロード中...","ENG":"ロード中..."}}});
            LANSA.showPage("MYLOGIN");
         }(window["LANSA"]))
      </script>
      <noscript>This page requires JavaScript.</noscript>
   </body>
</html>
For example, instead of the following URL, I want to use a HTML file.


http:// webserver /dcxpgmlib /dem /mylogin.html ?employeenumber=a0000

Best regards,
Taku

dannyoorburg
Posts: 169
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Post by dannyoorburg » Thu Oct 17, 2019 10:42 am

Hi Taku,

When you say:

"I would like to add a parameter to below HTML source."

What does that even mean?

Can you try to explain what you're trying to achieve?

Cheers,
Danny

Dominik
Posts: 17
Joined: Fri Jun 10, 2016 12:14 pm

Re: Can I add an arbitrary parameter into LANSA Web plugin page?

Post by Dominik » Thu Oct 17, 2019 3:18 pm

I just spoke to Taku about this; he is attempting to call LANSA.Init() and LANSA.showPage() internal functions manually, rather than using the generated HTML page that LANSA creates (he took that documentation page to indicate that its fine to do this yourself).
He was hoping that if he passed parameters into the Init function or showPage function, they would be accessible in his web page.

I explained to him that he cannot pass parameters into those functions; and that if he wants to retrieve an employee number for example he should take it from the browser storage, or supplied from a server module (session data), or from the URL as indicated from a previous response.

However it should be noted that when taking the value from a URL parameter, or even browser storage, a hacker could just edit the value passed in to potentially bypass security (i.e. dont use it to pass in the currently logged in emplyee)

Post Reply