I think what needs to happen is that things need to happen in the following order:
- detect submitted page - $this->GetPageKey_forData();
- detect requested page - $this->DetectPageRequest();
- determine page to show - $this->HandlePageRequest();
- calculate if requested page should be displayed
- load all form controls needed to receive submitted & show display page
- 2019-04-28 probably what needs to happen here is that we need to duplicate the logic of whatever calls vcCartDataManager::GetBuyerObject() et al. (currently includes capturing, rendering, and other stuff) and just create the requisite objects, don't try to use them yet.
- 2019-05-04 The first problem is to figure out how to make sure that this logic gets invoked during the setup events (KI_NODE_EVENT_DO_BUILDING or KI_NODE_EVENT_DO_FIGURING, not sure which is preferable)
- Seems like it should be happening in vcPageContent_ckout::OnRunCalculations, which does get called.
- ...but we're trying to receive the form first, here in vcPageContent_ckout::ProcessPage(), before the controls have been created...
- ...which happens in vcPageContent_ckout::CapturePage, which is called before the input is processed in vcPageContent_ckout::DetectPageRequest() so we know which controls to create.
- So CapturePage() needs to be split into two parts:
- receive raw form data (do not load into controls; just detect request)
- load form data into control objects (which must be created first)
- ...except no, it doesn't; I moved the CapturePage() call so it comes last, and still get the error -- so apparently the controls are not being created wherever I thought they were (where was that again?)
- receive submitted page - $this->CapturePage($oRes);
- process submitted page
To examine -- how do the following functions intersect with the above steps?: