5.12 Validation Forms

A validation form can be used when fields are validated with a validation file. Often the contents of the field being validated is a code that exists in another RMSfile. If the operator forgets the desired code, there is no convenient way to look up the code from the current data entry form. If you name another form in the Validation Form field, the operator can temporarily switch to that form, find the desired code, and switch back to the current data entry form.

The operator switches to the validation form by pressing GOLD <F1> and then the V key while the cursor is in the field being validated. The form named in the Validation Form field is displayed on the screen. The operator can perform queries using that form to find the desired code. The operator can also add or update records using the validation form if those operations are allowed. If the -v flag is not used in the form command line, only QUERY and FIND are allowed when using a validation form. When the desired code is found (or added), the operator switches back to the current data entry form by pressing GOLD <F1> and the E key.

The code that was displayed on the validation form is copied back to the field being validated on the current form. Form then continues data entry with the next field on the form.

You must create the validation form itself as another form in the same formfile. It should have the Repeating Form field set to yes, and possibly the Unique Records field set to yes, and all other form description fields should be no. The Next Form Name field should be the same as the name of the validation form.

When using a validation form, the user may not switch to another form by using the NEXTFORM <F7> or FIRSTFORM <F1>1 keys. Also, the user may not use the EXIT <F8> key to exit from form until returning to the current data entry form.

As an example, we will use a validation form with the subscriber field in the Subscriptions form. We must add a second data entry form, which we call valsubscriber. The Field Description for the subscriber field is shown below.

gifs/00000001.gif

The Validation Form field contains the name of the valsubscriber form. When the user is in the subscriber field and presses GOLD <F1> and then V, the valsubscriber form is displayed. Pressing GOLD <F1> and E returns the user back to the Subscriptions form. The example below is a listing of a complete formfile using a validation form.

Contents of formfile vscript

Form Name: subscription

Data File: script

Beginning form yes Unique records no

Repeating form yes Append form no

Freeze form no Multiple record no

Next form name: subscription

gifs/00000001.gif

Line 4, Column 2, Field name: subscriber , Field length 15

Entry Allowed yes Input required yes

In Data File yes Invisible no

Validation file: sub

Validation Form: valsubscriber

Line 7, Column 2, Field name: magazine , Field length 15

Entry Allowed yes Input required yes

In Data File yes Invisible no

Validation file: mag

Line 7, Column 22, Field name: , Field length 35

Entry Allowed no Input required no

In Data File no Invisible no

Lookup field: title

Line 10, Column 2, Field name: started , Field length 10

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 13, Column 2 , Field name: issues , Field length 5

Entry Allowed yes Input required yes

In Data File yes Invisible no

Form Name: valsubscriber

Data File: sub

Beginning form yes Unique records yes

Repeating form no Append form no

Freeze form no Multiple record no

Next form name: valsubscriber

gifs/00000001.gif

Line 3, Column 22, Field name: subscriber , Field length 15

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 5, Column 22, Field name: name , Field length 35

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 7, Column 22, Field name: address[1] , Field length 35

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 8, Column 22, Field name: address[2] , Field length 35

Entry Allowed yes Input required no

In Data File yes Invisible no

Line 10, Column 22, Field name: city , Field length 31

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 12, Column 22, Field name: state , Field length 7

Entry Allowed yes Input required yes

In Data File yes Invisible no

Line 12, Column 46, Field name: zip , Field length 11

Entry Allowed yes Input required yes

In Data File yes Invisible no