 |
Online Help System
|
 |
Back to Brilliant Database Web-Site |
Write to Support |
Help Index
Using forms for entering variables
Introduction
Forms can be used not only for data storage, but as well for entering variables and using them afterwards in scripts.
Using forms for entering data, it is possible to enter several values in a convenient form.
Description
Any form can be used as a form for data entry. For example, let's create a form with three fields and name it as Form1:
The fields are of following types: simple text field, date field, many-to-many relational field. If the database has no other forms, the created form may be indicated as a reference form for the many-to-many relational field. Now, let's create a toolbar button, by clicking which a data entry form will be shown.
- Open Toolbar Editor and create a new button.
- In the opened script editor, click the Add Variable button and choose the Set Vars By Form option from the menu.
- This action will show you a form, and after the data entry will create variables, the names of which consist of two parts:
user-set prefixes and field name. If we choose the var_ prefix, then in our example the following variables will be created: var_title, var_date, var_notes, var_notes_sel, var_. The origin of the two latest variables will be covered later. So, set up the following input parameters:
- Prefix: var_
- Form: form1
- Form title text: Testing Form Input.
-
Add one more script line in order to show entered values:
Run the script and enter the following data:
Click Ok. The variables will be created within the script, and you shall see the following message:
[$var_notes] variable is a database software recordset, with relational field entries. The [$var_notes_sel] variable is a database software recordset with entries selected at the moment of clicking the OK button. Recordset variables can be used, for instance, for operations in a database software recordset. To learn more, see the Usage of RecordSet Variables section.
The variable with the name of the selected prefix ([$var_]) is equal to 1 in case the user has clicked Ok. It is empty if the user has clicked Cancel or just closed the window.
Pre-check of entered data
It is possible to add a pre-check of entered data in the form editor.
- Open the form editor, choose a form for a data entry, and go to the Scripts and Behaviour tab.
- Set the On Confirm option equal to Execute Script:
- To cancel data entry using the script, if it happens that the user did not fill the form correctly, set the [$cancel] variable equal to 1.
Let's create a script to verify the Title field entry:
- Save the script, close the script editor. Click the toolbar button to open an input window. Leaving the field empty, click Ok. If the script is composed correctly, you shall see a warning about incorrect data entry, and the window shall resume opened:
The On Confirm verification script is also executed on creating a new database software record with the help of the popup form.
See Also:
Variables
Text/Math/Date Variables
Script Designer
List of actions
|