cIDModel ID; do not repeat the main User Function name.
AdvPL GuideFWFormModel():New(cID,[bPre],[bPost],bCommit,bCancel)Centralizes MVC model structure, validation and persistence.
FWFormModel defines submodels, relationships and validations independently of the UI. This entry covers a selected lifecycle, not every method. In the base class, CommitData delegates persistence to the constructor’s bCommit block: the method name does not create persistence automatically. VldData without an ID validates the whole model; validating a submodel does not mark the whole model as validated. Atilio separates model/view using MPFormModel and custom tables; that does not establish constructor equivalence. The fragment assumes oModel is configured and activated, with operation/data supplied by its caller. (Sources: refs. 1–2.)
FWFormModel():New(cID,[bPre],[bPost],bCommit,bCancel)cIDModel ID; do not repeat the main User Function name.
bPrePrevalidation returning logical.
bPostPostvalidation returning logical.
bCommitPersistence implementation.
bCancelCancellation implementation.
oModel:Activate([lCopy])oModel:VldData([cIDModel],[lVldOwner]) -> lRetLogical.
oModel:CommitData() -> lRetLogical.
// Fragment: oModel is configured/active, with defined persistence.
Local lSaved := .F.
// Validate the whole model before requesting persistence.
If oModel:VldData()
lSaved := oModel:CommitData()
EndIf
// Handle model errors; do not end a caller-owned transaction here.Requests persistence only after full validation succeeds. Does not establish commit of an external transaction. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.