Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing values between forms
#1
Hi,

I am struggling to pass values between IWforms.
Relatively new to Intraweb, previous small projects had only one form so no issues encountered.
 
This new project has 6 forms and needs some information to be passed between them.
I have tried to create a record in the usersession, thinking a new usersession was created for each instance, but now find that the details are overwritten by the last user.
It must be an easy task to pass values between forms but so far it has eluded me.
Can you recommend the best way forward.
 
Embarrassed 30+ year Delphi programmer!
Reply
#2
Hi, I have a user ID logged into the system, shared with the forms as follows:
Code:
unit UserSessionUnit;
  private
    { Private declarations }
    xJNP_Id: Integer;
  public
    { Public declarations }
    property gJNP_Id: Integer read xJNP_Id write xJNP_Id;

In login form, after user logged in:
Code:
UserSession.gJNP_Id := FDQ_UsrId.Value;
Reply
#3
Hi, thanks for the reply.
Think I have now sorted it by changing the servercontroler properties
SessionOptions.UniqueURL to true
SecurityOptions.SurrogateSession to false
This looks like it has fixed the issue of one session overwriting the public variables of another.

Thanks again for your help.
Reply
#4
(04-22-2021, 03:07 PM)Hexsol Wrote: Hi, thanks for the reply.
Think I have now sorted it by changing the  servercontroler properties
SessionOptions.UniqueURL to true
SecurityOptions.SurrogateSession to false
This looks like it has fixed the issue of one session overwriting the public variables of another.

Thanks again for your help.

It is best to think of it a little differently, keeping in mind what a "session" is.  

Your first instinct of keeping "session persistent" data in the UserSession is correct.  If you are accessing UserSession data from more than one browser window it sounds like you are attempting to have two browser windows operating on the same session?   It's not clear from your description but, if that's what you have in mind, you will likely have other issues.  

Having multiple windows working on the same session is not a simple (or recommended) thing.  What are you trying to accomplish?

Dan

(04-22-2021, 12:05 PM)Jose Nilton Pace Wrote: Hi, I have a user ID logged into the system, shared with the forms as follows:
Code:
unit UserSessionUnit;
  private
    { Private declarations }
    xJNP_Id: Integer;
  public
    { Public declarations }
    property gJNP_Id: Integer read xJNP_Id write xJNP_Id;

In login form, after user logged in:
Code:
UserSession.gJNP_Id := FDQ_UsrId.Value;

You're certainly the expert on this but I'm trying to understand what you are doing.

Are you having multiple browser sessions connected to the same IW session?  If so, how do you deconflict when the browsers launch multiple threads against the same session?   It doesn't matter with Integers as you've shown above but with other data?  Is IW doing this internally by session?

It makes my head hurt.

Thanks,
Dan

Weird: The above message was actually two separate messages a few minutes apart. One in reply to Hexsol, one to Jose.

Somehow the forum combined them.

Dan

Hah! And a third one!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)