Brilliant Database Software - Home
Database software - Online Help System

Online Help System

Back to Brilliant Database Web-Site | Write to Support | Help Index



Using forms for entering variables

table border="0" width="100%" cellspacing="0" cellpadding="4" bgcolor="#00000077">
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.

  1. Open Toolbar Editor and create a new button.
  2. In the opened script editor, click the Add Variable button and choose the Set Vars By Form option from the menu.
  3. 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.
  4. 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 recordset, with relational field entries. The [$var_notes_sel] variable is a recordset with entries selected at the moment of clicking the OK button. Recordset variables can be used, for instance, for operations in a 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.

  1. Open the form editor, choose a form for a data entry, and go to the Scripts and Behaviour tab.
  2. Set the On Confirm option equal to Execute Script:

  3. 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:

  4. 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 record with the help of the popup form.



All topics in the "Variables" section: