Hi Guys,
Apologies if this sounds like a stupid question, I am still learning my way around Ebase and its foibles! Is there a way to store variables between form pages, in a kind of global-variable way? Or just by passing the variable to a form field from one form to another?
For example, I have created a basic login form and a script in Ebase that does a lookup in a database table for the username and password, and if they both exist, opens the next form. Is there any way that I can take the user-entered username value and apply it to a text box on the NEXT form to be loaded, or store it as a variable somewhere that I can then use to do further database work with once the user has proceeded past the login form? As far as I can see, as soon as the next form is loaded, the current script is ended, so I can't do something like:
goto FORM FRM_2;
set FIELD1 = un; (if 'un' is the username variable in the current form)
I know this sounds like such a stupid question, apologies it is my first foray into coding in FPL and Ebase. Thanks in advance for any help
Passing variables between forms/fields
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 3
- Joined: Mon Jan 09, 2012 6:36 pm
-
- Moderator
- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
You have 2 options:
Option 1
In the 2nd form, you check the 'URL parameter' checkbox for any field which will be passed into that form (say UN). The 1st form then does something like:
As the 2nd form starts, UN will be set to FORM1_UN from the 1st form.
Option 2
The 1st form uses function setsessionvariable to store the username within the browser session, e.g.
The 2nd form uses function getsessionvariable to extract the username from the browser session, e.g.
I've used FORM1_UN, FORM2_UN for clarity. No reason why you can't use UN in both forms - there'll be no confusion.
See the online documentation for more details. Search getsessionvariable and you'll find it.
I hope this helps.
Option 1
In the 2nd form, you check the 'URL parameter' checkbox for any field which will be passed into that form (say UN). The 1st form then does something like:
Code: Select all
goto form FRM_2 UN=FORM1_UN; // what's on the right hand must be a field in the 1st form
Option 2
The 1st form uses function setsessionvariable to store the username within the browser session, e.g.
Code: Select all
STATUS = setsessionvariable('UN', FORM1_UN); // STATUS is a char field - will be set to 'OK'
Code: Select all
FORM2_UN = getsessionvariable('UN');
See the online documentation for more details. Search getsessionvariable and you'll find it.
I hope this helps.
0 x
-
- Ebase User
- Posts: 3
- Joined: Mon Jan 09, 2012 6:36 pm
Who is online
Users browsing this forum: No registered users and 111 guests