Global variables or share info among forms

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

Global variables or share info among forms

#1

Postby xren » Tue Feb 05, 2013 4:28 pm

Hi,

sometimes, I will need to save some information in the session that can be shared by all the forms in that session.

How can this be done?

Thanks,
Xiaoli
0 x

asperion
Ebase User
Posts: 8
Joined: Sat Feb 02, 2013 8:24 pm

#2

Postby asperion » Tue Feb 05, 2013 5:42 pm

You can use the setsessionvariable / getsessionvariable functions to pass data between forms in each session.

For security, you may wish to encrypt the values you store in the session variables.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#3

Postby xren » Wed Feb 06, 2013 2:59 pm

Thank you!
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#4

Postby xren » Wed Feb 06, 2013 5:38 pm

What is the corresponding usage in javascript?

Thanks,
Xiaoli
0 x

Steve
Moderator
Moderator
Posts: 423
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#5

Postby Steve » Thu Feb 07, 2013 9:40 am

Hi,

The session methods can be found in client.getFormSession();

So to set a form session attribute in JavaScript:

Code: Select all

client.getFormSession().setFormSessionAttribute("myAttribute", "Hello");
Jon mentioned encryption. If you wanted to encrypt your data, you will need to use encryption services:

Code: Select all

//encrypt
var encrypted = EncryptionServices.encrypt("Hello");
//decrypt
var decrypted = EncryptionServices.decrypt(encrypted);
Steve
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#6

Postby xren » Tue Feb 12, 2013 3:20 pm

What is the benefit of encrypting? I think the session object is only available at the server side. It won't travel between browser and server.
Is my understanding correct?

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#7

Postby Jon » Thu Feb 14, 2013 11:52 am

Yes, that's correct.
0 x


Who is online

Users browsing this forum: No registered users and 28 guests