Passing values to a web app

how do you pass a value to a web app when you initialise it with HTML? If for instance I want to have a web app display an image after a user clicks a link, how would I go about that. In windows it was possible to use DDE or OLE, but I cant see how to do that in the web app docs.

See Session.URLParameter()
http://documentation.xojo.com/index.php/WebSession.URLParameter

Then you can call your app as

http://127.0.0.1:8080/?picture=mypicture.jpg or http://website.com/cgi-bin/myapp.cgi-bin?picture=mypicture.png

1 Like

[quote=113031:@Michel Bujardet]http://127.0.0.1:8080/?picture=mypicture.jpg
or
http://website.com/cgi-bin/myapp.cgi-bin?picture=mypicture.png[/quote]
Thanks Michel, though just to be clear the example line that includes port 8080 would be used when testing the hyperlink on the development computer?

Yes. To test that, I ran the project in the IDE, then opened a new browser and typed the URL I posted, so the opened session had that as parameters. It works for standalone.

I am still confused as to where the web session statement should reside. Should it go in a dedicated module or a window event. Since it appears to be a non-visual object where should one refer to it?

http://documentation.xojo.com/index.php/WebSession.URLParameter [quote=113039:@Chris Benton]I am still confused as to where the web session statement should reside. Should it go in a dedicated module or a window event. Since it appears to be a non-visual object where should one refer to it?[/quote]

In the project, you got a class Session, usually right underneath App, which is the websession. Have a look at :

http://documentation.xojo.com/index.php/WebSession
“This is the base class for the Session class that is included in all web projects. Each user session gets its own instance of WebSession that you can access using the Session method.”

You get URLParameter as a string, by calling for instance
string = Session.URLParameter(Picture)

Everything is explained here :

See Session.URLParameter()
http://documentation.xojo.com/index.php/WebSession.URLParameter

for example like this code in session open event:

if me.URLParameterExists(“register”) then
dim n as string = me.URLParameter(“register”)
registerPage.iEMail.Text = n
registerPage.show
Return

end if

so if URL ends with ?register=hello

than we move user to register page directly and prefill the email.