Atozed Forums
get url params 15.1.5 - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: get url params 15.1.5 (/thread-1356.html)



get url params 15.1.5 - MrSpock - 11-03-2019

intraweb 15.1.5
I have had no luck getting a session url params in serverController-onGetMainForm
so I cannot change main form according to an identified param like http://url/?test


RE: get url params 15.1.5 - MrSpock - 11-03-2019

(11-03-2019, 12:08 PM)MrSpock Wrote: After a couple of hours I have found a solution
Code:
1) in UserSession class in "Public" sector put variable "parametr"

2) in UserSession.OnCreate put

  if WebApplication.RunParams.Count>0
  then
    parametr:=WebApplication.RunParams[0]
  else
    parametr:='';

3) in ServerController.OnGetMainForm put

  if UserSession.parametr = 'steg'
  then
    vmainForm:=TIWForm9.Create(WebApplication)
  else
    vmainForm:=TIWForm2.Create(WebApplication)

4) start your application with

http://YourAppDomain.org/$/start?steg



RE: get url params 15.1.5 - MrSpock - 11-03-2019

Another idea is not to put any code in user session unit

Code:
in ServerController.OnGetMainForm put

  if WebApplication.RunParams.Count>0
  then
  begin
     if WebApplication.RunParams[0]='steg'
     then
        vmainForm:=TIWForm9.Create(WebApplication)
     else
        vmainForm:=TIWForm2.Create(WebApplication)
  end
  else
     vmainForm:=TIWForm2.Create(WebApplication)  //usual main form



RE: get url params 15.1.5 - kudzu - 11-04-2019

Yes the last variant is the best one.