>Hilmar,
>
>The response outlining your design to handle validation looks very interesting. I was wondering if you would be willing to share more of it by putting together a small demo. You know what they say, "A picture is worth a thousand words".
Well, I might put it into the download section, eventually, with a small demo form and table.
For now, let me briefly outline the main ideas.
I use it as part of the VFX framework, but it could be integrated into almost any framework.
I will assume that you use buffering.
I postpone almost all validation of data input until the user saves data. This is for several reasons; 1) the user might choose not to input data in the exact order which the programmer prescribes through the TabOrder; 2) some validation rules depend on more than one field; 3) the user might choose to undo the changes, in which case it is a hassle to click an "undo" button, if the "undo" button is on the same form.
To validate a table, say, "Client", create two new records in the validation table, and put the following kind of contents.
Record 1:
Table = Client
Rule = not empty(ClientCode)
Spanish = You must provide a code.
Level = (leave blank) (this makes it a strict rule)
Record 2:
Table = Client
Rule = not empty(ClientNames)
Spanish = The client name can't be empty.
Level = (leave blank)
Then, in the code that saves the record, simply validate for:
RecordValid("Client")
For example, in Visual Extend, this would be:
return RecordValid("Client")
If you maintain your record-saving code yourself, the code on your form might look like this:
Form.OnSave()
if RecordValid("Client")
DoDefault()
endif
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)