Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting a validation failure of child by grandparent c
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01092783
Message ID:
01092844
Vues:
19
>Hi Naomi
>
>>I made a slight modification in that code. If dodefault returned true you don't need to get lcErrorMsg.
>
>Thanks. I will update it accordingly.
>
>>But I don't see other problems and it looks like you're correct. The only other suggestion would be to move textbox validation to a form's custom method and call it in BeforeSave instead of drill-down textbox validation.
>
>I guess I was not able to explain my problem. CodeBook has the following (puesdo) code:
>
>cForm.Save()
>
>IF NOT THIS.BeforeSave()
>   RETURN
>ENDIF
>
>*** save stuff here
>
>THIS.AfterSave()
>
>
>iForm.Save() does not have anything but iForm.BeforeSave() has the code you have seen, this is the one I have put in for my usage. But all of this is form code, yes I am validating key things in the MyForm.BeforeSave() but when I return a false, essentially cForm is doing a simple return without messaging. My code in iForm() does the messaging but I presume it will only message cForm problems. Actually I want to message MyForm generically in iForm.
>
>Any advice on how to modify iForm.Save() or iForm.BeforeSave() without modifying the framework code in cForm?
>
>Please advise.

When and how the error reporting is done? If I understood you correctly you want to be able to add your errors in form's error array and let the form Display the error, rather than do some direct error displaying. So, I need to know more about when errors are displayed.

In my case I usually do it manually in form's PreSaveHook, e.g.
llReturn = dodefault()
if llReturn
if not MyFirstCondition()
ErrorMsg(my first error message)
else
...
endif
endif
return llReturn

But I think you'd rather utilize form's DisplayErrors methods. If so, I'm not sure, you may be needed to call this method yourself after adding the error to array. Let me know more about BeforeSave and Save methods...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform