by COBS Tech Support » Wed Apr 12, 2006 9:47 am
To do this:
1. Select Special|Screen Builder from the main menu.
2. Open the screen you wish to work on.
3. From the Screen Builder main menu select File|Screen Script.
4. In this area you can control behaviours relating to the entire record.
Here is an example script with a few input checks to guide you, taken from the Service Manager area:
If Mode = 3
If IsEmpty(ScrRead("SMEMAIL"))
Echo("Sorry, you must fill in the email address.")
SCRFocusOn("SMEMAIL")
Return FALSE
Endif
If IsEmpty(ScrRead("PHONE"))
Echo("Sorry, you must fill in the phone number.")
SCRFocusOn("PHONE")
Return FALSE
Endif
If SCRRead("Received") < Today()
Echo("Sorry, the received date cannot be less than today.")
SCRFocusOn("RECEIVED")
Return FALSE
Endif
* Add more checks/conditions here.
* ...
* ...
* ...
Endif
If you read the help topic "Screen Builder Script Creation" you will find a table describing the various mode settings available to you. When Mode = 3 the operator has just pressed the "Save" button. At this point you can accept the record--in which case it will be saved to the database--or you can Return FALSE, in which case the record will not be saved and the operator must continue editing.
Use the SCRRead() function to retrieve the input from a field.
Use the Echo() function to display messages on what the user did wrong.
Use the SCRFocusOn() function to return focus (position the caret/cursor) on a particular field. (This just makes it easier/faster for operators to correct their mistakes.)