Page 1 of 1

Submit button to execute .Net VB program

Posted: Fri Dec 15, 2017 4:38 am
by TracyC
In one of our WAMs I have a Submit button defined on the page as:
<input onclick="{$SBMJS}" id="EFSUBMIT"
style="color: white; background-color: DarkBlue; height: 21px;"
type="submit" usemap=" " value="Submit" />

In that Wam’s rdmlx code #SBMJS is set like the following in order to execute a .Net VB program passing in data from the WAM page:
#SBMJS := "document.forms['LANSA'].action='http://domain:port/PGMA.aspx';document.forms['LANSA'].submit();"

How do I accomplish the same thing in a Visual Lansa (V14) reusable part?

Re: Submit button to execute .Net VB program

Posted: Fri Dec 15, 2017 10:02 am
by MarkDale
I think you are basically opening a URL on the client.

The VL web reusable part is already running on the client, so these two ways might suit

Either

Code: Select all

Define_Com Class(#PRIM_WEB.Page) Name(#WebPage) Description('Web Page') Displayposition(1) Height(327) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Width(587)
...
#WebPage.Source := 'http://domain:port/PGMA.aspx'

OR

Code: Select all

#sys_web.Navigate Target(New) Url('http://domain:port/PGMA.aspx')
If you need to get additional data from the web page to the .Net program, the easiest way would be to include it as parameters on the URL, (and modify the .Net program to get its data that way)

Re: Submit button to execute .Net VB program

Posted: Tue Dec 19, 2017 1:46 am
by TracyC
Thank you for your response. I would need to encrypt (at least some of) the data before adding it to the URL and decrypt it in the .Net program. I was hoping not to have to do that. Are there alternative(s) for getting the data to the .Net program from my reusable part?

Re: Submit button to execute .Net VB program

Posted: Tue Dec 19, 2017 10:58 am
by tsupartono
I'm not entirely clear on the problem, but if what you want is to do a POST request from the browser, you can use PRIM_WEB.HttpRequest

See the documentation below for more details:
http://docs.lansa.com/14/en/lansa016/pr ... equest.htm

Question:
When you say you have to encrypt the data before adding to the URL, are you worried about the data appearing on the address bar of the browser?

Re: Submit button to execute .Net VB program

Posted: Wed Dec 20, 2017 1:33 am
by TracyC
Yes, there's sensitive data that I don't want to be seen in the URL. I do want to do a post, so I think the prim_web.httpRequest looks like it'll work for me. Thank you!