Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validation / Where to Put code / Where to call it?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00210514
Message ID:
00210669
Vues:
17
>Bob,
>
>I wrestled with the same problem a few months ago. I wound up calling my validation routines twice. Once from the individual controls valid method and a second time at the record save. The validation routines run very fast so the second run is not really a problem. If speed is an issue, you could create an lPassFail property in your oValid object, initialize it to false and set to true once a field passes your test. Then you could avoid any controls that passed during the second run.
>

Well... I don't know if speed is an issue... considering how the validation class works... I am doing alot more than a simple... "thisfield > 6" in the rule. Every field will call the IsValid... it will get the validation rules from DBCX... if there is NO rule or MustValidate is false it will return true right away. I guess I'll just have to implement it, put the data on a file server and see how it runs.


>with several messages and wonder why I didn't tell them earlier. One thing I added to make the user's life a little easier is the ability of the user to set which fields get checked. By double clicking on the text box label, they can

We do have a Validate logical field in the meta data... if that is flase it will return .t. automatically.

Since I posted this I read a section in Jim Booths Advanced Techniques about this subject. He recomends calling the rule from the view and the table. However, if it is called from a rule, put up a wait window and return .t.. If it is called from the table, return false.

This will keep them from getting stuck in the field when doing data entry but won't allow bad data to get saved. But, as we said, code is running twice. I guess its necessary if we want to DBC to keep our rules.

Matt... thanks alot... anyone else have any ideas/comments?

BOb
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform