Closed GittingGudAtIT closed 1 month ago
Hey, I just worked today on this for a project. You can find the complete request in BaseErpPageModel pageModel The form is pageModel.Request.Form - this is the standard ASP form in other words a dictionary.
if (form.ContainsKey("customer_id") && !string.IsNullOrWhiteSpace(form["customer_id"].ToString()))
{
if (Guid.TryParse(form["customer_id"].ToString(), out Guid outGuid))
{
customerId = outGuid;
}
}
this is how I deal with it. This is done OnPost.
Another good tip is that OnGet you can preinit the form values by setting them up in the Record. Example:
EntityRecord record = new EntityRecord();
record["customer_id"] = SOME_GUID
pageModel.DataModel.SetRecord(record);
Hope this helps
Thank you @bzashev, that totally helped!
I'm just getting into your software. It is pretty easy to setup pages with the generated body editor but I have no idea how i can create pages with it when there is no record or data source to map.
The problem is: I'm creating a page that downloads data from the internet and directly imports them into the database. So I tried to create a form where I linked my custom page hook (IPageHook). And a button submits this form. So far so good page hook is working correctly but I have no Idea where I could get the values of defined Fields within a BaseErpPageModel.
Do I have to create a custom body instead or am I missing something?