Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validation on fields in a grid don't prevent button clic
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Divers
Thread ID:
01525801
Message ID:
01525879
Vues:
48
>I have a form with a grid and several buttons. When I add validation to fields in the grid, a failed validation doesn't prevent a button outside the grid from getting focus and clicking. I can't believe I've never noticed this behavior before. Is there an easy way around this? Failing validation on a field in a grid should prevent the form's save button from being clicked, for example.


Thanks for the suggestions. Form level validation is important, and I do include both form level validation and field validation in most forms, including the form in question. Form level validation is not sufficient for all tasks, however. For example, if a user is keying in a product ID for a line item on an invoice and there are several other values on the form that get populated based on the entry, you have to evaluate it immediately.

In this scenario, I have added some validation to grid.valid event to call the ActiveColumn's validation, and have been able to make the form work properly.

However, I discovered that grid1.valid fires before the grid1.column1.text1.valid fires, and that the value of the control in the grid has not yet been pushed to the controlsource it is bound to. That was a little bit of a gotcha with the way validations are currently written and had to be addressed.

I certainly consider it a bug that when the textbox is inside a grid cell, a failed validation doesn't prevent you from clicking on a button on your form. Hopefully this will help anyone else who runs across this.
Paul R. Moon
Business Software Solutions
paul@businessoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform