Multi-entity form
GOERP now supports multiple entities definitions in one form, which allows to save data of many different, unrelated entities at once.
Note
Multi-entity form supports only one postAction type for all scoped entities. For example, it cannot be used to delete one and create another entity at once. Only delete for all related entities OR create/update for all related entities.
Let’s say we need to create warehouse and point of sale records by submitting them in one form, then code would look like this:
<form method="POST">
{{/* Define entity names that should be processed */}}
<input type="hidden" name="postActionEntity" value="WarehouseInput">
<input type="hidden" name="postActionEntity" value="PointOfSale">
{{/* Warehouse input data */}}
<fieldset>
<legend>Warehouse:</legend>
<label for="name-eng">Name eng:</label>
<input type="text" id="name-eng" name="AccountAdminApi.WarehouseInput.Name.en"
value="{{ .Data.AccountAdminApi.WarehouseInput.Name.en }}">
<label for="name-est">Name est:</label>
<input type="text" id="name-est" name="AccountAdminApi.WarehouseInput.Name.et"
value="{{ .Data.AccountAdminApi.WarehouseInput.Name.et }}">
</fieldset>
{{/* Point of sale input data */}}
<fieldset>
<legend>Point of sale:</legend>
<label for="name-pos">Name:</label>
<input type="text" id="name-pos" name="AccountAdminApi.PointOfSale.Name"
value="{{ .Data.AccountAdminApi.PointOfSale.Name }}">
<label for="name-shop">Shop name:</label>
<input type="text" id="name-shop" name="AccountAdminApi.PointOfSale.ShopName"
value="{{ .Data.AccountAdminApi.PointOfSale.ShopName }}">
</fieldset>
</form>